authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-04-28 22:58:12-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-04-28 22:58:12-07:00
logc60d8f017ea698c5fe4c7c6046f8ca09f0b8bf1d
treebbb3db8d212f7612bc5d81f6754f33a060b06ae2
parent0c71d2fdc1cfa251b1c45a93724240a052c77a92

std: remove redundant comptime keyword

@g-w1's fancy new compile error in action

12 files changed, 26 insertions(+), 26 deletions(-)

lib/std/crypto/25519/edwards25519.zig+2-2
...@@ -226,12 +226,12 @@ pub const Edwards25519 = struct {...@@ -226,12 +226,12 @@ pub const Edwards25519 = struct {
226 return pc;226 return pc;
227 }227 }
228228
229 const basePointPc = comptime pc: {229 const basePointPc = pc: {
230 @setEvalBranchQuota(10000);230 @setEvalBranchQuota(10000);
231 break :pc precompute(Edwards25519.basePoint, 15);231 break :pc precompute(Edwards25519.basePoint, 15);
232 };232 };
233233
234 const basePointPc8 = comptime pc: {234 const basePointPc8 = pc: {
235 @setEvalBranchQuota(10000);235 @setEvalBranchQuota(10000);
236 break :pc precompute(Edwards25519.basePoint, 8);236 break :pc precompute(Edwards25519.basePoint, 8);
237 };237 };
lib/std/crypto/25519/field.zig+1-1
...@@ -292,7 +292,7 @@ pub const Fe = struct {...@@ -292,7 +292,7 @@ pub const Fe = struct {
292 return _carry128(&r);292 return _carry128(&r);
293 }293 }
294294
295 fn _sq(a: Fe, double: comptime bool) callconv(.Inline) Fe {295 fn _sq(a: Fe, double: bool) callconv(.Inline) Fe {
296 var ax: [5]u128 = undefined;296 var ax: [5]u128 = undefined;
297 var r: [5]u128 = undefined;297 var r: [5]u128 = undefined;
298 comptime var i = 0;298 comptime var i = 0;
lib/std/crypto/aes.zig+3-3
...@@ -8,9 +8,9 @@ const std = @import("../std.zig");...@@ -8,9 +8,9 @@ const std = @import("../std.zig");
8const testing = std.testing;8const testing = std.testing;
9const builtin = std.builtin;9const builtin = std.builtin;
1010
11const has_aesni = comptime std.Target.x86.featureSetHas(std.Target.current.cpu.features, .aes);11const has_aesni = std.Target.x86.featureSetHas(std.Target.current.cpu.features, .aes);
12const has_avx = comptime std.Target.x86.featureSetHas(std.Target.current.cpu.features, .avx);12const has_avx = std.Target.x86.featureSetHas(std.Target.current.cpu.features, .avx);
13const has_armaes = comptime std.Target.aarch64.featureSetHas(std.Target.current.cpu.features, .aes);13const has_armaes = std.Target.aarch64.featureSetHas(std.Target.current.cpu.features, .aes);
14const impl = if (std.Target.current.cpu.arch == .x86_64 and has_aesni and has_avx) impl: {14const impl = if (std.Target.current.cpu.arch == .x86_64 and has_aesni and has_avx) impl: {
15 break :impl @import("aes/aesni.zig");15 break :impl @import("aes/aesni.zig");
16} else if (std.Target.current.cpu.arch == .aarch64 and has_armaes)16} else if (std.Target.current.cpu.arch == .aarch64 and has_armaes)
lib/std/crypto/aes_ocb.zig+2-2
...@@ -106,8 +106,8 @@ fn AesOcb(comptime Aes: anytype) type {...@@ -106,8 +106,8 @@ fn AesOcb(comptime Aes: anytype) type {
106 return offset;106 return offset;
107 }107 }
108108
109 const has_aesni = comptime std.Target.x86.featureSetHas(std.Target.current.cpu.features, .aes);109 const has_aesni = std.Target.x86.featureSetHas(std.Target.current.cpu.features, .aes);
110 const has_armaes = comptime std.Target.aarch64.featureSetHas(std.Target.current.cpu.features, .aes);110 const has_armaes = std.Target.aarch64.featureSetHas(std.Target.current.cpu.features, .aes);
111 const wb: usize = if ((std.Target.current.cpu.arch == .x86_64 and has_aesni) or (std.Target.current.cpu.arch == .aarch64 and has_armaes)) 4 else 0;111 const wb: usize = if ((std.Target.current.cpu.arch == .x86_64 and has_aesni) or (std.Target.current.cpu.arch == .aarch64 and has_armaes)) 4 else 0;
112112
113 /// c: ciphertext: output buffer should be of size m.len113 /// c: ciphertext: output buffer should be of size m.len
lib/std/crypto/ghash.zig+3-3
...@@ -137,9 +137,9 @@ pub const Ghash = struct {...@@ -137,9 +137,9 @@ pub const Ghash = struct {
137 return z0 | z1 | z2 | z3;137 return z0 | z1 | z2 | z3;
138 }138 }
139139
140 const has_pclmul = comptime std.Target.x86.featureSetHas(std.Target.current.cpu.features, .pclmul);140 const has_pclmul = std.Target.x86.featureSetHas(std.Target.current.cpu.features, .pclmul);
141 const has_avx = comptime std.Target.x86.featureSetHas(std.Target.current.cpu.features, .avx);141 const has_avx = std.Target.x86.featureSetHas(std.Target.current.cpu.features, .avx);
142 const has_armaes = comptime std.Target.aarch64.featureSetHas(std.Target.current.cpu.features, .aes);142 const has_armaes = std.Target.aarch64.featureSetHas(std.Target.current.cpu.features, .aes);
143 const clmul = if (std.Target.current.cpu.arch == .x86_64 and has_pclmul and has_avx) impl: {143 const clmul = if (std.Target.current.cpu.arch == .x86_64 and has_pclmul and has_avx) impl: {
144 break :impl clmul_pclmul;144 break :impl clmul_pclmul;
145 } else if (std.Target.current.cpu.arch == .aarch64 and has_armaes) impl: {145 } else if (std.Target.current.cpu.arch == .aarch64 and has_armaes) impl: {
lib/std/crypto/modes.zig+1-1
...@@ -16,7 +16,7 @@ const debug = std.debug;...@@ -16,7 +16,7 @@ const debug = std.debug;
16///16///
17/// Important: the counter mode doesn't provide authenticated encryption: the ciphertext can be trivially modified without this being detected.17/// Important: the counter mode doesn't provide authenticated encryption: the ciphertext can be trivially modified without this being detected.
18/// As a result, applications should generally never use it directly, but only in a construction that includes a MAC.18/// As a result, applications should generally never use it directly, but only in a construction that includes a MAC.
19pub fn ctr(comptime BlockCipher: anytype, block_cipher: BlockCipher, dst: []u8, src: []const u8, iv: [BlockCipher.block_length]u8, endian: comptime builtin.Endian) void {19pub fn ctr(comptime BlockCipher: anytype, block_cipher: BlockCipher, dst: []u8, src: []const u8, iv: [BlockCipher.block_length]u8, endian: builtin.Endian) void {
20 debug.assert(dst.len >= src.len);20 debug.assert(dst.len >= src.len);
21 const block_length = BlockCipher.block_length;21 const block_length = BlockCipher.block_length;
22 var counter: [BlockCipher.block_length]u8 = undefined;22 var counter: [BlockCipher.block_length]u8 = undefined;
lib/std/crypto/poly1305.zig+1-1
...@@ -39,7 +39,7 @@ pub const Poly1305 = struct {...@@ -39,7 +39,7 @@ pub const Poly1305 = struct {
39 };39 };
40 }40 }
4141
42 fn blocks(st: *Poly1305, m: []const u8, last: comptime bool) void {42 fn blocks(st: *Poly1305, m: []const u8, last: bool) void {
43 const hibit: u64 = if (last) 0 else 1 << 40;43 const hibit: u64 = if (last) 0 else 1 << 40;
44 const r0 = st.r[0];44 const r0 = st.r[0];
45 const r1 = st.r[1];45 const r1 = st.r[1];
lib/std/debug.zig+3-3
...@@ -353,18 +353,18 @@ pub const StackIterator = struct {...@@ -353,18 +353,18 @@ pub const StackIterator = struct {
353 }353 }
354354
355 // Offset of the saved BP wrt the frame pointer.355 // Offset of the saved BP wrt the frame pointer.
356 const fp_offset = if (comptime native_arch.isRISCV())356 const fp_offset = if (native_arch.isRISCV())
357 // On RISC-V the frame pointer points to the top of the saved register357 // On RISC-V the frame pointer points to the top of the saved register
358 // area, on pretty much every other architecture it points to the stack358 // area, on pretty much every other architecture it points to the stack
359 // slot where the previous frame pointer is saved.359 // slot where the previous frame pointer is saved.
360 2 * @sizeOf(usize)360 2 * @sizeOf(usize)
361 else if (comptime native_arch.isSPARC())361 else if (native_arch.isSPARC())
362 // On SPARC the previous frame pointer is stored at 14 slots past %fp+BIAS.362 // On SPARC the previous frame pointer is stored at 14 slots past %fp+BIAS.
363 14 * @sizeOf(usize)363 14 * @sizeOf(usize)
364 else364 else
365 0;365 0;
366366
367 const fp_bias = if (comptime native_arch.isSPARC())367 const fp_bias = if (native_arch.isSPARC())
368 // On SPARC frame pointers are biased by a constant.368 // On SPARC frame pointers are biased by a constant.
369 2047369 2047
370 else370 else
lib/std/hash/crc.zig+2-2
...@@ -28,7 +28,7 @@ pub const Crc32 = Crc32WithPoly(.IEEE);...@@ -28,7 +28,7 @@ pub const Crc32 = Crc32WithPoly(.IEEE);
28pub fn Crc32WithPoly(comptime poly: Polynomial) type {28pub fn Crc32WithPoly(comptime poly: Polynomial) type {
29 return struct {29 return struct {
30 const Self = @This();30 const Self = @This();
31 const lookup_tables = comptime block: {31 const lookup_tables = block: {
32 @setEvalBranchQuota(20000);32 @setEvalBranchQuota(20000);
33 var tables: [8][256]u32 = undefined;33 var tables: [8][256]u32 = undefined;
3434
...@@ -128,7 +128,7 @@ test "crc32 castagnoli" {...@@ -128,7 +128,7 @@ test "crc32 castagnoli" {
128pub fn Crc32SmallWithPoly(comptime poly: Polynomial) type {128pub fn Crc32SmallWithPoly(comptime poly: Polynomial) type {
129 return struct {129 return struct {
130 const Self = @This();130 const Self = @This();
131 const lookup_table = comptime block: {131 const lookup_table = block: {
132 var table: [16]u32 = undefined;132 var table: [16]u32 = undefined;
133133
134 for (table) |*e, i| {134 for (table) |*e, i| {
lib/std/heap.zig+3-3
...@@ -28,17 +28,17 @@ const CAllocator = struct {...@@ -28,17 +28,17 @@ const CAllocator = struct {
28 }28 }
29 }29 }
3030
31 usingnamespace if (comptime @hasDecl(c, "malloc_size"))31 usingnamespace if (@hasDecl(c, "malloc_size"))
32 struct {32 struct {
33 pub const supports_malloc_size = true;33 pub const supports_malloc_size = true;
34 pub const malloc_size = c.malloc_size;34 pub const malloc_size = c.malloc_size;
35 }35 }
36 else if (comptime @hasDecl(c, "malloc_usable_size"))36 else if (@hasDecl(c, "malloc_usable_size"))
37 struct {37 struct {
38 pub const supports_malloc_size = true;38 pub const supports_malloc_size = true;
39 pub const malloc_size = c.malloc_usable_size;39 pub const malloc_size = c.malloc_usable_size;
40 }40 }
41 else if (comptime @hasDecl(c, "_msize"))41 else if (@hasDecl(c, "_msize"))
42 struct {42 struct {
43 pub const supports_malloc_size = true;43 pub const supports_malloc_size = true;
44 pub const malloc_size = c._msize;44 pub const malloc_size = c._msize;
lib/std/io/bit_reader.zig+3-3
...@@ -23,9 +23,9 @@ pub fn BitReader(endian: builtin.Endian, comptime ReaderType: type) type {...@@ -23,9 +23,9 @@ pub fn BitReader(endian: builtin.Endian, comptime ReaderType: type) type {
23 pub const Reader = io.Reader(*Self, Error, read);23 pub const Reader = io.Reader(*Self, Error, read);
2424
25 const Self = @This();25 const Self = @This();
26 const u8_bit_count = comptime meta.bitCount(u8);26 const u8_bit_count = meta.bitCount(u8);
27 const u7_bit_count = comptime meta.bitCount(u7);27 const u7_bit_count = meta.bitCount(u7);
28 const u4_bit_count = comptime meta.bitCount(u4);28 const u4_bit_count = meta.bitCount(u4);
2929
30 pub fn init(forward_reader: ReaderType) Self {30 pub fn init(forward_reader: ReaderType) Self {
31 return Self{31 return Self{
lib/std/io/bit_writer.zig+2-2
...@@ -23,8 +23,8 @@ pub fn BitWriter(endian: builtin.Endian, comptime WriterType: type) type {...@@ -23,8 +23,8 @@ pub fn BitWriter(endian: builtin.Endian, comptime WriterType: type) type {
23 pub const Writer = io.Writer(*Self, Error, write);23 pub const Writer = io.Writer(*Self, Error, write);
2424
25 const Self = @This();25 const Self = @This();
26 const u8_bit_count = comptime meta.bitCount(u8);26 const u8_bit_count = meta.bitCount(u8);
27 const u4_bit_count = comptime meta.bitCount(u4);27 const u4_bit_count = meta.bitCount(u4);
2828
29 pub fn init(forward_writer: WriterType) Self {29 pub fn init(forward_writer: WriterType) Self {
30 return Self{30 return Self{