aboutsummaryrefslogtreecommitdiff
path: root/lib/std/crypto/utils.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-04-22 18:07:46 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-04-22 18:07:46 -0700
commit507a8096d2f9624bafaf963c3e189a477ef6b7bf (patch)
treec21e3d54e1389fe44ecc7d5f230e792e26ab322d /lib/std/crypto/utils.zig
parent7c453b91b85bab6800d24feb57c4f35b8ce48d57 (diff)
downloadzig-507a8096d2f9624bafaf963c3e189a477ef6b7bf.tar.gz
zig-507a8096d2f9624bafaf963c3e189a477ef6b7bf.zip
std: fix compile errors caught by stage2 AstGen
* `comptime const` is redundant * don't use `extern enum`; specify a tag type. `extern enum` is only when you need tags to alias. But aliasing tags is a smell. I will be making a proposal shortly to remove `extern enum` from the language. * there is no such thing as `packed enum`. * instead of `catch |_|`, omit the capture entirely. * unused function definition with missing parameter name * using `try` outside of a function or test
Diffstat (limited to 'lib/std/crypto/utils.zig')
-rw-r--r--lib/std/crypto/utils.zig12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/std/crypto/utils.zig b/lib/std/crypto/utils.zig
index 08271ac9f4..4e02092ed8 100644
--- a/lib/std/crypto/utils.zig
+++ b/lib/std/crypto/utils.zig
@@ -16,9 +16,9 @@ pub fn timingSafeEql(comptime T: type, a: T, b: T) bool {
for (a) |x, i| {
acc |= x ^ b[i];
}
- comptime const s = @typeInfo(C).Int.bits;
- comptime const Cu = std.meta.Int(.unsigned, s);
- comptime const Cext = std.meta.Int(.unsigned, s + 1);
+ const s = @typeInfo(C).Int.bits;
+ const Cu = std.meta.Int(.unsigned, s);
+ const Cext = std.meta.Int(.unsigned, s + 1);
return @bitCast(bool, @truncate(u1, (@as(Cext, @bitCast(Cu, acc)) -% 1) >> s));
},
.Vector => |info| {
@@ -27,9 +27,9 @@ pub fn timingSafeEql(comptime T: type, a: T, b: T) bool {
@compileError("Elements to be compared must be integers");
}
const acc = @reduce(.Or, a ^ b);
- comptime const s = @typeInfo(C).Int.bits;
- comptime const Cu = std.meta.Int(.unsigned, s);
- comptime const Cext = std.meta.Int(.unsigned, s + 1);
+ const s = @typeInfo(C).Int.bits;
+ const Cu = std.meta.Int(.unsigned, s);
+ const Cext = std.meta.Int(.unsigned, s + 1);
return @bitCast(bool, @truncate(u1, (@as(Cext, @bitCast(Cu, acc)) -% 1) >> s));
},
else => {