diff options
| author | Jan Philipp Hafer <jan.hafer@rwth-aachen.de> | 2021-09-03 01:12:48 +0200 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-11-29 12:50:25 -0800 |
| commit | 1ea650bb75e009bb37b5bd4e896a90e2a86f8583 (patch) | |
| tree | b23a47759b5c2f5c0f00a367227a56b03503c174 /lib/std/special/compiler_rt.zig | |
| parent | d3426ce634a09ec289480510040b3decfbd38c39 (diff) | |
| download | zig-1ea650bb75e009bb37b5bd4e896a90e2a86f8583.tar.gz zig-1ea650bb75e009bb37b5bd4e896a90e2a86f8583.zip | |
compiler_rt: add __popcountsi2, __popcountdi2 and __popcountti2
- apply simpler approach than LLVM for __popcountdi2
taken from The Art of Computer Programming and generalized
- rename popcountdi2.zig to popcount.zig
- test cases derived from popcountdi2_test.zig
- tests: compare naive approach 10_000 times with
random numbers created from naive seed 42
See #1290
Diffstat (limited to 'lib/std/special/compiler_rt.zig')
| -rw-r--r-- | lib/std/special/compiler_rt.zig | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/std/special/compiler_rt.zig b/lib/std/special/compiler_rt.zig index ee32e49282..e3d2c5b7e5 100644 --- a/lib/std/special/compiler_rt.zig +++ b/lib/std/special/compiler_rt.zig @@ -177,7 +177,6 @@ comptime { .linkage = linkage, }); }, - else => {}, } @@ -334,8 +333,12 @@ comptime { const __udivmoddi4 = @import("compiler_rt/int.zig").__udivmoddi4; @export(__udivmoddi4, .{ .name = "__udivmoddi4", .linkage = linkage }); - const __popcountdi2 = @import("compiler_rt/popcountdi2.zig").__popcountdi2; + const __popcountsi2 = @import("compiler_rt/popcount.zig").__popcountsi2; + @export(__popcountsi2, .{ .name = "__popcountsi2", .linkage = linkage }); + const __popcountdi2 = @import("compiler_rt/popcount.zig").__popcountdi2; @export(__popcountdi2, .{ .name = "__popcountdi2", .linkage = linkage }); + const __popcountti2 = @import("compiler_rt/popcount.zig").__popcountti2; + @export(__popcountti2, .{ .name = "__popcountti2", .linkage = linkage }); if (is_darwin) { const __isPlatformVersionAtLeast = @import("compiler_rt/os_version_check.zig").__isPlatformVersionAtLeast; |
