diff options
| author | 2018-03-20 15:31:48 +0100 | |
|---|---|---|
| committer | 2018-03-20 15:31:48 +0100 | |
| commit | 784f6768115288d0d910e44577ff074c25a364b0 (patch) | |
| tree | 5ec3e7978b23d983cc9a6038723e25024ebbc4ee | |
| parent | Implemented chaining of small arguments (diff) | |
| download | zig-clap-784f6768115288d0d910e44577ff074c25a364b0.tar.gz zig-clap-784f6768115288d0d910e44577ff074c25a364b0.tar.xz zig-clap-784f6768115288d0d910e44577ff074c25a364b0.zip | |
Removed bits.zig
| -rw-r--r-- | bits.zig | 9 | ||||
| -rw-r--r-- | clap.zig | 3 |
2 files changed, 1 insertions, 11 deletions
diff --git a/bits.zig b/bits.zig deleted file mode 100644 index 64f7d8b..0000000 --- a/bits.zig +++ /dev/null | |||
| @@ -1,9 +0,0 @@ | |||
| 1 | const math = @import("std").math; | ||
| 2 | |||
| 3 | pub fn set(comptime Int: type, num: Int, bit: math.Log2Int(Int), value: bool) Int { | ||
| 4 | return (num & ~(Int(1) << bit)) | (Int(value) << bit); | ||
| 5 | } | ||
| 6 | |||
| 7 | pub fn get(comptime Int: type, num: Int, bit: math.Log2Int(Int)) bool { | ||
| 8 | return ((num >> bit) & 1) != 0; | ||
| 9 | } | ||
| @@ -1,5 +1,4 @@ | |||
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | const bits = @import("bits.zig"); | ||
| 3 | 2 | ||
| 4 | const mem = std.mem; | 3 | const mem = std.mem; |
| 5 | const fmt = std.fmt; | 4 | const fmt = std.fmt; |
| @@ -109,7 +108,7 @@ pub fn Parser(comptime Result: type, comptime ParseError: type, comptime default | |||
| 109 | fn newRequired(option: &const OptionT, old_required: u128, index: usize) u128 { | 108 | fn newRequired(option: &const OptionT, old_required: u128, index: usize) u128 { |
| 110 | switch (option.kind) { | 109 | switch (option.kind) { |
| 111 | OptionT.Kind.Required => { | 110 | OptionT.Kind.Required => { |
| 112 | return bits.set(u128, old_required, u7(index), false); | 111 | return old_required & ~(u128(1) << u7(index)); |
| 113 | }, | 112 | }, |
| 114 | OptionT.Kind.IgnoresRequired => return 0, | 113 | OptionT.Kind.IgnoresRequired => return 0, |
| 115 | else => return old_required, | 114 | else => return old_required, |