diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2017-03-31 05:48:15 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2017-03-31 05:55:41 -0400 |
| commit | 3ca027ca8219dbdbb6467645944c4daada037f51 (patch) | |
| tree | 786a6c4ecac9f11d3a60f3c14c1b4276a3adc8d6 /std/special/compiler_rt.zig | |
| parent | 536c35136ab98f2f56d07937727b3c99c0e35c5c (diff) | |
| download | zig-3ca027ca8219dbdbb6467645944c4daada037f51.tar.gz zig-3ca027ca8219dbdbb6467645944c4daada037f51.zip | |
first pass at zig build system
* `zig build --export [obj|lib|exe]` changed to `zig build_obj`,
`zig build_lib` and `zig build_exe` respectively.
* `--name` parameter is optional when it can be inferred from the
root source filename. closes #207
* `zig build` now looks for `build.zig` which interacts with
`std.build.Builder` to describe the targets, and then the zig
build system prints TODO: build these targets. See #204
* add `@bitcast` which is mainly used for pointer reinterpret
casting and make explicit casting not do pointer reinterpretation.
Closes #290
* fix debug info for byval parameters
* sort command line help options
* `std.debug.panic` supports format string printing
* add `std.mem.IncrementingAllocator`
* fix const ptr to a variable with data changing at runtime.
closes #289
Diffstat (limited to 'std/special/compiler_rt.zig')
| -rw-r--r-- | std/special/compiler_rt.zig | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/std/special/compiler_rt.zig b/std/special/compiler_rt.zig index 8f61876305..f5c83becc7 100644 --- a/std/special/compiler_rt.zig +++ b/std/special/compiler_rt.zig @@ -15,7 +15,7 @@ export fn __udivdi3(a: du_int, b: du_int) -> du_int { fn du_int_to_udwords(x: du_int) -> udwords { @setDebugSafety(this, false); - return *(&udwords)(&x); + return *@bitcast(&udwords, &x); } export fn __udivmoddi4(a: du_int, b: du_int, maybe_rem: ?&du_int) -> du_int { @@ -66,7 +66,7 @@ export fn __udivmoddi4(a: du_int, b: du_int, maybe_rem: ?&du_int) -> du_int { if (var rem ?= maybe_rem) { r[high] = n[high] % d[high]; r[low] = 0; - *rem = *(&du_int)(&r[0]); + *rem = *@bitcast(&du_int, &r[0]); } return n[high] / d[high]; } @@ -78,7 +78,7 @@ export fn __udivmoddi4(a: du_int, b: du_int, maybe_rem: ?&du_int) -> du_int { if (var rem ?= maybe_rem) { r[low] = n[low]; r[high] = n[high] & (d[high] - 1); - *rem = *(&du_int)(&r[0]); + *rem = *@bitcast(&du_int, &r[0]); } return n[high] >> @ctz(d[high]); } @@ -89,7 +89,7 @@ export fn __udivmoddi4(a: du_int, b: du_int, maybe_rem: ?&du_int) -> du_int { // 0 <= sr <= n_uword_bits - 2 or sr large if (sr > n_uword_bits - 2) { if (var rem ?= maybe_rem) { - *rem = *(&du_int)(&n[0]); + *rem = *@bitcast(&du_int, &n[0]); } return 0; } @@ -113,12 +113,12 @@ export fn __udivmoddi4(a: du_int, b: du_int, maybe_rem: ?&du_int) -> du_int { *rem = n[low] & (d[low] - 1); } if (d[low] == 1) { - return *(&du_int)(&n[0]); + return *@bitcast(&du_int, &n[0]); } sr = @ctz(d[low]); q[high] = n[high] >> sr; q[low] = (n[high] << (n_uword_bits - sr)) | (n[low] >> sr); - return *(&du_int)(&q[0]); + return *@bitcast(&du_int, &q[0]); } // K X // --- @@ -154,7 +154,7 @@ export fn __udivmoddi4(a: du_int, b: du_int, maybe_rem: ?&du_int) -> du_int { // 0 <= sr <= n_uword_bits - 1 or sr large if (sr > n_uword_bits - 1) { if (var rem ?= maybe_rem) { - *rem = *(&du_int)(&n[0]); + *rem = *@bitcast(&du_int, &n[0]); } return 0; } @@ -191,17 +191,17 @@ export fn __udivmoddi4(a: du_int, b: du_int, maybe_rem: ?&du_int) -> du_int { // r.all -= d.all; // carry = 1; // } - const s: di_int = (di_int)(*(&du_int)(&d[0]) - *(&du_int)(&r[0]) - 1) >> (n_udword_bits - 1); + const s: di_int = (di_int)(*@bitcast(&du_int, &d[0]) - *@bitcast(&du_int, &r[0]) - 1) >> (n_udword_bits - 1); carry = su_int(s & 1); - *(&du_int)(&r[0]) -= *(&du_int)(&d[0]) & u64(s); + *@bitcast(&du_int, &r[0]) -= *@bitcast(&du_int, &d[0]) & u64(s); sr -= 1; } - *(&du_int)(&q[0]) = (*(&du_int)(&q[0]) << 1) | u64(carry); + *@bitcast(&du_int, &q[0]) = (*@bitcast(&du_int, &q[0]) << 1) | u64(carry); if (var rem ?= maybe_rem) { - *rem = *(&du_int)(&r[0]); + *rem = *@bitcast(&du_int, &r[0]); } - return *(&du_int)(&q[0]); + return *@bitcast(&du_int, &q[0]); } export fn __umoddi3(a: du_int, b: du_int) -> du_int { |
