15 Commits

Author SHA1 Message Date
Jan Prudil
aadccc4206 Make std.meta.Int accept a signedness parameter 2020-10-17 14:09:59 +02:00
Vexu
1df0f3ac24
update uses of deprecated type field access 2020-09-03 18:10:40 +03:00
Andrew Kelley
b498eebfd4 std.math.big: fix use-after-free
When there is parameter aliasing, the ensureCapacity calls can cause the
Const parameters to become dangling pointers.

See #6167
2020-08-25 19:49:40 -07:00
Andrew Kelley
4a69b11e74 add license header to all std lib files
add SPDX license identifier
copyright ownership is zig contributors
2020-08-20 16:07:04 -04:00
Vexu
e85fe13e44
run zig fmt on std lib and self hosted 2020-07-11 20:41:19 +03:00
Andrew Kelley
8766821157 rework std.math.big.Int
Now there are 3 types:
 * std.math.big.int.Const
   - the memory is immutable, only stores limbs and is_positive
   - all methods operating on constant data go here
 * std.math.big.int.Mutable
   - the memory is mutable, stores capacity in addition to limbs and
     is_positive
   - methods here have some Mutable parameters and some Const
     parameters. These methods expect callers to pre-calculate the
     amount of resources required, and asserts that the resources are
     available.
 * std.math.big.int.Managed
   - the memory is mutable and additionally stores an allocator.
   - methods here perform the resource calculations for the programmer.
   - this is the high level abstraction from before

Each of these 3 types can be converted to the other ones.

You can see the use case for this in the self-hosted compiler, where we
only store limbs, and construct the big ints as needed.

This gets rid of the hack where the allocator was optional and the
notion of "fixed" versions of the struct. Such things are now modeled
with the `big.int.Const` type.
2020-05-01 06:47:56 -04:00
Tadeo Kondrak
350b2adacd
std.meta.IntType -> std.meta.Int 2020-04-28 19:11:31 -06:00
joachimschmidt557
1ee59c5c31 move big.rational.gcd to big.int.gcd 2020-04-07 13:43:15 -04:00
xackus
7a28c644aa new ArrayList API: fix everything else 2020-04-02 16:12:08 +02:00
Joachim Schmidt
5acc8afb5f
Use math.Order for comparing bigints instead of i8 (#4791) 2020-03-23 23:16:57 -04:00
Vexu
538d9a5dd8
remove uses of @ArgType and @IntType 2020-02-24 23:39:03 +02:00
Vexu
45da72c5b6
remove usages of @typeId, @memberCount, @memberName and @memberType 2020-02-24 23:09:01 +02:00
daurnimator
6ea6d5a4bd
std: use testing.allocator in tests 2020-02-14 19:15:09 +11:00
LemonBoy
e81b505960 Use the correct calling convention for AEABI intrinsics 2020-01-07 13:42:47 -05:00
Andrew Kelley
ed36dbbd9c
mv std/ lib/
that's all this commit does. further commits will fix cli flags and
such.

see #2221
2019-09-25 23:35:41 -04:00