LemonBoy
20fba0933f
std/deflate: Avoid reading past end of stream
...
Use a conservative (and slower) approach in the Huffman decoder fast
path.
Closes #6847
2020-10-29 17:16:03 +01:00
Jan Prudil
aadccc4206
Make std.meta.Int accept a signedness parameter
2020-10-17 14:09:59 +02:00
Tadeo Kondrak
e892ee17e6
std: move std.meta.refAllDecls to std.testing
2020-10-15 20:34:22 -04:00
xavier
a0a834a2f2
restore ability to do comptime math
...
until https://github.com/ziglang/zig/issues/6168 is implemented,
partially revert 0bd53dd2033c60d3446abfb83209237c6eb6c9e2
in order to restore the ability to use std.math in comptime functions.
2020-10-07 17:04:48 -04:00
Vexu
1df0f3ac24
update uses of deprecated type field access
2020-09-03 18:10:40 +03:00
Andrew Kelley
427e2d689d
Merge pull request #6189 from katesuyu/div-ceil
...
std: Add std.math.divCeil
2020-08-30 01:09:39 -04:00
Kate Tsuyu
e496485af4
std.math.divCeil: fix expectEqual argument order
2020-08-29 03:07:36 -04:00
Kate Tsuyu
552e2bf758
std.math.divCeil: use expectEqual for tests
2020-08-29 02:32:54 -04:00
Kate Tsuyu
340871f061
std.math.divCeil: move compile error back down
2020-08-29 00:37:10 -04:00
Kate Tsuyu
49e67ce0e8
std.math.divCeil: move compile error to top
2020-08-29 00:31:49 -04:00
Kate Tsuyu
933bfcff64
std.math.divCeil: support comptime_int/float
2020-08-29 00:21:17 -04:00
Kate Tsuyu
f577d12fbc
std.math.divCeil: conform to more test cases
2020-08-28 11:20:42 -04:00
Kate Tsuyu
14b6fb88fb
std.math.divCeil: handle floats correctlier
2020-08-28 09:55:50 -04:00
Kate Tsuyu
aacfef17d5
std.math.divCeil: handle floats correctly
2020-08-28 09:48:40 -04:00
Kate Tsuyu
9dfb917c20
std: Add std.math.divCeil
2020-08-28 08:58:51 -04:00
Frank Denis
ad18078d53
forceEval() -> doNotOptimizeAway()
2020-08-26 10:50:34 +02:00
Frank Denis
0bd53dd203
Rename blackBox, move it to std.mem.forceEval()
2020-08-26 10:50:34 +02: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
Andrew Kelley
28a9da8bfc
stage2: implement while loops (bool condition)
...
* introduce a dump() function on Module.Fn which helpfully prints to
stderr the ZIR representation of a function (can be called before
attempting to codegen it). This is a debugging tool.
* implement x86 codegen for loops
* liveness: fix analysis of conditional branches. The logic was buggy
in a couple ways:
- it never actually saved the results into the IR instruction (fixed now)
- it incorrectly labeled operands as dying when their true death was
after the conditional branch ended (fixed now)
* zir rendering is enhanced to show liveness analysis results. this
helps when debugging liveness analysis.
* fix bug in zir rendering not numbering instructions correctly
closes #6021
2020-08-13 20:32:32 -07:00
Andrew Kelley
9f5a7d5922
utilize math.ceilPowerOfTwo
2020-08-08 00:39:46 -07:00
Vexu
e85fe13e44
run zig fmt on std lib and self hosted
2020-07-11 20:41:19 +03:00
Andrew Kelley
ab9df5b04b
stage2: machine code for condbr jumps
2020-07-08 05:35:41 +00:00
antlilja
eb7fad28f8
Improve f128 standard library support
...
* Add functions: floor128, ceil128, trunc128 and round128
* Add corresponding tests
2020-06-17 18:18:45 +02:00
Andrew Kelley
6b0f7de247
ZIR: add cmp and condbr instructions
2020-05-01 06:47:20 -04:00
Tadeo Kondrak
350b2adacd
std.meta.IntType -> std.meta.Int
2020-04-28 19:11:31 -06:00
Andrius Mitkus
157f566f2d
std: make math.clamp work for common uses, remove automatic bounds swapping
2020-04-16 16:19:12 -04:00
LemonBoy
4e95662a4a
std: Add qNaN constants
2020-03-24 18:08:53 +01:00
daurnimator
e9c3b65bf4
std: use testing.expectEqual in math.absCast tests
2020-03-05 16:02:26 +11:00
daurnimator
488ba1560f
std: fix math.absCast on i1
2020-03-05 16:00:19 +11:00
LemonBoy
e029032251
std: Use @TypeOf(x,y) as return value for max
2020-03-04 17:21:10 -05: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
Hersh Krishna
e7917d099d
Add clamp function to math module
2020-01-14 13:06:46 -05:00
Andrew Kelley
5575e2a168
std.mem.compare: breaking API changes
...
* `std.mem.Compare` is now `std.math.Order` and the enum tags
renamed to follow new style convention.
* `std.mem.compare` is renamed to `std.mem.order`.
* new function `std.math.order`
2020-01-01 18:08:40 -05:00
Andrew Kelley
9468d63819
allow comparison of any numeric types
2019-12-16 11:09:10 -05:00
Shawn Landden
143603b39f
std: lessThan and greaterThan between signed and unsigned
...
It is a deviation from C, but I think we should consider making this the behavior
of the operators. See #2133
2019-12-16 01:41:26 -05:00
Robin Voetter
4b4fbe3887
Replace @typeOf with @TypeOf in all zig source
...
This change was mostly made with `zig fmt` and this also modified some whitespace. Note that in some files, `zig fmt` produced incorrect code, so the change was made manually.
2019-12-10 11:09:41 -05:00
Andrew Kelley
2ab7f31e99
std.math: remove constants that should be expressions
...
All four of these can be represented in fewer characters with
expressions, which will be guaranteed to happen at compile-time, and
have the same or better precision.
The other math constants here which depend on function calls could be
similarly removed if and when #425 is solved. However I left them for
now since Zig does not eagerly evaluate functions with comptime parameters.
2019-11-29 10:48:46 -05:00
dbandstra
b3539b40a6
add std.math.tau
constant (equivalent to 2 * pi)
2019-11-19 06:20:20 +00:00
Andrew Kelley
aa0daea541
update more of the std lib to use @as
2019-11-08 15:57:25 -05:00
Andrew Kelley
e0db54e89d
update the codebase to use @as
2019-11-08 15:57:24 -05:00
Andrew Kelley
8591731f2b
refAllDecls in a test block to limit when it gets run
2019-10-24 00:32:18 -04:00
Andrew Kelley
f80c01f9d8
ref more math decls for better docs
2019-10-16 19:16:57 -04:00
Andrew Kelley
7598a579ff
turn comments into doc comments
2019-10-16 18:33:12 -04:00
Sebsatian Keller
1b07ff7be0
Add 'missing' consts to math.zig
...
The C library defines constants for log2e and sqrt2 etc. Those should also be available in zig.
2019-10-16 18:31:22 -04:00
Andrew Kelley
6d54e8fc3c
generated docs: render values
...
also fix pressing enter in search box before search finishes
closes #3409
2019-10-09 18:09:35 -04: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