summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jimmi Holst Christensen2018-03-20 15:31:48 +0100
committerGravatar Jimmi Holst Christensen2018-03-20 15:31:48 +0100
commit784f6768115288d0d910e44577ff074c25a364b0 (patch)
tree5ec3e7978b23d983cc9a6038723e25024ebbc4ee
parentImplemented chaining of small arguments (diff)
downloadzig-clap-784f6768115288d0d910e44577ff074c25a364b0.tar.gz
zig-clap-784f6768115288d0d910e44577ff074c25a364b0.tar.xz
zig-clap-784f6768115288d0d910e44577ff074c25a364b0.zip
Removed bits.zig
Diffstat (limited to '')
-rw-r--r--bits.zig9
-rw-r--r--clap.zig3
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 @@
1const math = @import("std").math;
2
3pub 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
7pub fn get(comptime Int: type, num: Int, bit: math.Log2Int(Int)) bool {
8 return ((num >> bit) & 1) != 0;
9}
diff --git a/clap.zig b/clap.zig
index 189f757..c966b18 100644
--- a/clap.zig
+++ b/clap.zig
@@ -1,5 +1,4 @@
1const std = @import("std"); 1const std = @import("std");
2const bits = @import("bits.zig");
3 2
4const mem = std.mem; 3const mem = std.mem;
5const fmt = std.fmt; 4const 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,