| author | |
| committer | |
| log | 13070448f5f1dba172946e6a1e1a5c885093cad8 |
| tree | 3a93756f6be0af7361240f461f452cb7372200f6 |
| parent | 49f2cca872c24d617082e9b21cbd8ac50e96bc50 |
| signature |
54 files changed, 95 insertions(+), 95 deletions(-)
doc/langref.html.in+2-2| ... | @@ -3498,7 +3498,7 @@ void do_a_thing(struct Foo *foo) { | ... | @@ -3498,7 +3498,7 @@ void do_a_thing(struct Foo *foo) { |
| 3498 | <p> | 3498 | <p> |
| 3499 | As a motivating example, consider the statement {#syntax#}const x: u32 = 42;{#endsyntax#}. The type | 3499 | As a motivating example, consider the statement {#syntax#}const x: u32 = 42;{#endsyntax#}. The type |
| 3500 | annotation here provides a result type of {#syntax#}u32{#endsyntax#} to the initialization expression | 3500 | annotation here provides a result type of {#syntax#}u32{#endsyntax#} to the initialization expression |
| 3501 | {#syntax#}42{#endsyntax#}, instructing the compiler to coerce this integer (initally of type | 3501 | {#syntax#}42{#endsyntax#}, instructing the compiler to coerce this integer (initially of type |
| 3502 | {#syntax#}comptime_int{#endsyntax#}) to this type. We will see more examples shortly. | 3502 | {#syntax#}comptime_int{#endsyntax#}) to this type. We will see more examples shortly. |
| 3503 | </p> | 3503 | </p> |
| 3504 | <p> | 3504 | <p> |
| ... | @@ -6833,7 +6833,7 @@ coding style. | ... | @@ -6833,7 +6833,7 @@ coding style. |
| 6833 | <li>utils, misc, or somebody's initials</li> | 6833 | <li>utils, misc, or somebody's initials</li> |
| 6834 | </ul> | 6834 | </ul> |
| 6835 | <p>Everything is a value, all types are data, everything is context, all logic manages state. | 6835 | <p>Everything is a value, all types are data, everything is context, all logic manages state. |
| 6836 | Nothing is communicated by using a word that applies to all types.</p> | 6836 | Nothing is communicated by using a word that applies to all types.</p> |
| 6837 | <p>Temptation to use "utilities", "miscellaneous", or somebody's initials | 6837 | <p>Temptation to use "utilities", "miscellaneous", or somebody's initials |
| 6838 | is a failure to categorize, or more commonly, overcategorization. Such | 6838 | is a failure to categorize, or more commonly, overcategorization. Such |
| 6839 | declarations can live at the root of a module that needs them with no | 6839 | declarations can live at the root of a module that needs them with no |
doc/langref/test_coerce_tuples_arrays.zig+1-1| ... | @@ -2,7 +2,7 @@ const std = @import("std"); | ... | @@ -2,7 +2,7 @@ const std = @import("std"); |
| 2 | const expect = std.testing.expect; | 2 | const expect = std.testing.expect; |
| 3 | 3 | ||
| 4 | const Tuple = struct { u8, u8 }; | 4 | const Tuple = struct { u8, u8 }; |
| 5 | test "coercion from homogenous tuple to array" { | 5 | test "coercion from homogeneous tuple to array" { |
| 6 | const tuple: Tuple = .{ 5, 6 }; | 6 | const tuple: Tuple = .{ 5, 6 }; |
| 7 | const array: [2]u8 = tuple; | 7 | const array: [2]u8 = tuple; |
| 8 | _ = array; | 8 | _ = array; |
lib/std/BitStack.zig+2-2| ... | @@ -20,8 +20,8 @@ pub fn deinit(self: *@This()) void { | ... | @@ -20,8 +20,8 @@ pub fn deinit(self: *@This()) void { |
| 20 | self.* = undefined; | 20 | self.* = undefined; |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | pub fn ensureTotalCapacity(self: *@This(), bit_capcity: usize) Allocator.Error!void { | 23 | pub fn ensureTotalCapacity(self: *@This(), bit_capacity: usize) Allocator.Error!void { |
| 24 | const byte_capacity = (bit_capcity + 7) >> 3; | 24 | const byte_capacity = (bit_capacity + 7) >> 3; |
| 25 | try self.bytes.ensureTotalCapacity(byte_capacity); | 25 | try self.bytes.ensureTotalCapacity(byte_capacity); |
| 26 | } | 26 | } |
| 27 | 27 |
lib/std/Build.zig+1-1| ... | @@ -2055,7 +2055,7 @@ pub fn dependencyFromBuildZig( | ... | @@ -2055,7 +2055,7 @@ pub fn dependencyFromBuildZig( |
| 2055 | } | 2055 | } |
| 2056 | 2056 | ||
| 2057 | const full_path = b.pathFromRoot("build.zig.zon"); | 2057 | const full_path = b.pathFromRoot("build.zig.zon"); |
| 2058 | debug.panic("'{}' is not a build.zig struct of a dependecy in '{s}'", .{ build_zig, full_path }); | 2058 | debug.panic("'{}' is not a build.zig struct of a dependency in '{s}'", .{ build_zig, full_path }); |
| 2059 | } | 2059 | } |
| 2060 | 2060 | ||
| 2061 | fn userValuesAreSame(lhs: UserValue, rhs: UserValue) bool { | 2061 | fn userValuesAreSame(lhs: UserValue, rhs: UserValue) bool { |
lib/std/Target/aarch64.zig+1-1| ... | @@ -887,7 +887,7 @@ pub const all_features = blk: { | ... | @@ -887,7 +887,7 @@ pub const all_features = blk: { |
| 887 | }; | 887 | }; |
| 888 | result[@intFromEnum(Feature.nv)] = .{ | 888 | result[@intFromEnum(Feature.nv)] = .{ |
| 889 | .llvm_name = "nv", | 889 | .llvm_name = "nv", |
| 890 | .description = "Enable v8.4-A Nested Virtualization Enchancement (FEAT_NV, FEAT_NV2)", | 890 | .description = "Enable v8.4-A Nested Virtualization Enhancement (FEAT_NV, FEAT_NV2)", |
| 891 | .dependencies = featureSet(&[_]Feature{}), | 891 | .dependencies = featureSet(&[_]Feature{}), |
| 892 | }; | 892 | }; |
| 893 | result[@intFromEnum(Feature.outline_atomics)] = .{ | 893 | result[@intFromEnum(Feature.outline_atomics)] = .{ |
lib/std/Target/arm.zig+1-1| ... | @@ -446,7 +446,7 @@ pub const all_features = blk: { | ... | @@ -446,7 +446,7 @@ pub const all_features = blk: { |
| 446 | }; | 446 | }; |
| 447 | result[@intFromEnum(Feature.fix_cmse_cve_2021_35465)] = .{ | 447 | result[@intFromEnum(Feature.fix_cmse_cve_2021_35465)] = .{ |
| 448 | .llvm_name = "fix-cmse-cve-2021-35465", | 448 | .llvm_name = "fix-cmse-cve-2021-35465", |
| 449 | .description = "Mitigate against the cve-2021-35465 security vulnurability", | 449 | .description = "Mitigate against the cve-2021-35465 security vulnerability", |
| 450 | .dependencies = featureSet(&[_]Feature{}), | 450 | .dependencies = featureSet(&[_]Feature{}), |
| 451 | }; | 451 | }; |
| 452 | result[@intFromEnum(Feature.fix_cortex_a57_aes_1742098)] = .{ | 452 | result[@intFromEnum(Feature.fix_cortex_a57_aes_1742098)] = .{ |
lib/std/Target/csky.zig+7-7| ... | @@ -214,7 +214,7 @@ pub const all_features = blk: { | ... | @@ -214,7 +214,7 @@ pub const all_features = blk: { |
| 214 | }; | 214 | }; |
| 215 | result[@intFromEnum(Feature.dsp_silan)] = .{ | 215 | result[@intFromEnum(Feature.dsp_silan)] = .{ |
| 216 | .llvm_name = "dsp_silan", | 216 | .llvm_name = "dsp_silan", |
| 217 | .description = "Enable DSP Silan instrutions", | 217 | .description = "Enable DSP Silan instructions", |
| 218 | .dependencies = featureSet(&[_]Feature{}), | 218 | .dependencies = featureSet(&[_]Feature{}), |
| 219 | }; | 219 | }; |
| 220 | result[@intFromEnum(Feature.dspe60)] = .{ | 220 | result[@intFromEnum(Feature.dspe60)] = .{ |
| ... | @@ -224,7 +224,7 @@ pub const all_features = blk: { | ... | @@ -224,7 +224,7 @@ pub const all_features = blk: { |
| 224 | }; | 224 | }; |
| 225 | result[@intFromEnum(Feature.dspv2)] = .{ | 225 | result[@intFromEnum(Feature.dspv2)] = .{ |
| 226 | .llvm_name = "dspv2", | 226 | .llvm_name = "dspv2", |
| 227 | .description = "Enable DSP V2.0 instrutions", | 227 | .description = "Enable DSP V2.0 instructions", |
| 228 | .dependencies = featureSet(&[_]Feature{}), | 228 | .dependencies = featureSet(&[_]Feature{}), |
| 229 | }; | 229 | }; |
| 230 | result[@intFromEnum(Feature.e1)] = .{ | 230 | result[@intFromEnum(Feature.e1)] = .{ |
| ... | @@ -243,7 +243,7 @@ pub const all_features = blk: { | ... | @@ -243,7 +243,7 @@ pub const all_features = blk: { |
| 243 | }; | 243 | }; |
| 244 | result[@intFromEnum(Feature.edsp)] = .{ | 244 | result[@intFromEnum(Feature.edsp)] = .{ |
| 245 | .llvm_name = "edsp", | 245 | .llvm_name = "edsp", |
| 246 | .description = "Enable DSP instrutions", | 246 | .description = "Enable DSP instructions", |
| 247 | .dependencies = featureSet(&[_]Feature{}), | 247 | .dependencies = featureSet(&[_]Feature{}), |
| 248 | }; | 248 | }; |
| 249 | result[@intFromEnum(Feature.elrw)] = .{ | 249 | result[@intFromEnum(Feature.elrw)] = .{ |
| ... | @@ -333,12 +333,12 @@ pub const all_features = blk: { | ... | @@ -333,12 +333,12 @@ pub const all_features = blk: { |
| 333 | }; | 333 | }; |
| 334 | result[@intFromEnum(Feature.hwdiv)] = .{ | 334 | result[@intFromEnum(Feature.hwdiv)] = .{ |
| 335 | .llvm_name = "hwdiv", | 335 | .llvm_name = "hwdiv", |
| 336 | .description = "Enable divide instrutions", | 336 | .description = "Enable divide instructions", |
| 337 | .dependencies = featureSet(&[_]Feature{}), | 337 | .dependencies = featureSet(&[_]Feature{}), |
| 338 | }; | 338 | }; |
| 339 | result[@intFromEnum(Feature.istack)] = .{ | 339 | result[@intFromEnum(Feature.istack)] = .{ |
| 340 | .llvm_name = "istack", | 340 | .llvm_name = "istack", |
| 341 | .description = "Enable interrput attribute", | 341 | .description = "Enable interrupt attribute", |
| 342 | .dependencies = featureSet(&[_]Feature{}), | 342 | .dependencies = featureSet(&[_]Feature{}), |
| 343 | }; | 343 | }; |
| 344 | result[@intFromEnum(Feature.java)] = .{ | 344 | result[@intFromEnum(Feature.java)] = .{ |
| ... | @@ -362,7 +362,7 @@ pub const all_features = blk: { | ... | @@ -362,7 +362,7 @@ pub const all_features = blk: { |
| 362 | }; | 362 | }; |
| 363 | result[@intFromEnum(Feature.multiple_stld)] = .{ | 363 | result[@intFromEnum(Feature.multiple_stld)] = .{ |
| 364 | .llvm_name = "multiple_stld", | 364 | .llvm_name = "multiple_stld", |
| 365 | .description = "Enable multiple load/store instrutions", | 365 | .description = "Enable multiple load/store instructions", |
| 366 | .dependencies = featureSet(&[_]Feature{}), | 366 | .dependencies = featureSet(&[_]Feature{}), |
| 367 | }; | 367 | }; |
| 368 | result[@intFromEnum(Feature.nvic)] = .{ | 368 | result[@intFromEnum(Feature.nvic)] = .{ |
| ... | @@ -372,7 +372,7 @@ pub const all_features = blk: { | ... | @@ -372,7 +372,7 @@ pub const all_features = blk: { |
| 372 | }; | 372 | }; |
| 373 | result[@intFromEnum(Feature.pushpop)] = .{ | 373 | result[@intFromEnum(Feature.pushpop)] = .{ |
| 374 | .llvm_name = "pushpop", | 374 | .llvm_name = "pushpop", |
| 375 | .description = "Enable push/pop instrutions", | 375 | .description = "Enable push/pop instructions", |
| 376 | .dependencies = featureSet(&[_]Feature{}), | 376 | .dependencies = featureSet(&[_]Feature{}), |
| 377 | }; | 377 | }; |
| 378 | result[@intFromEnum(Feature.smart)] = .{ | 378 | result[@intFromEnum(Feature.smart)] = .{ |
lib/std/Target/riscv.zig+2-2| ... | @@ -823,14 +823,14 @@ pub const all_features = blk: { | ... | @@ -823,14 +823,14 @@ pub const all_features = blk: { |
| 823 | }; | 823 | }; |
| 824 | result[@intFromEnum(Feature.zcmp)] = .{ | 824 | result[@intFromEnum(Feature.zcmp)] = .{ |
| 825 | .llvm_name = "zcmp", | 825 | .llvm_name = "zcmp", |
| 826 | .description = "'Zcmp' (sequenced instuctions for code-size reduction)", | 826 | .description = "'Zcmp' (sequenced instructions for code-size reduction)", |
| 827 | .dependencies = featureSet(&[_]Feature{ | 827 | .dependencies = featureSet(&[_]Feature{ |
| 828 | .zca, | 828 | .zca, |
| 829 | }), | 829 | }), |
| 830 | }; | 830 | }; |
| 831 | result[@intFromEnum(Feature.zcmt)] = .{ | 831 | result[@intFromEnum(Feature.zcmt)] = .{ |
| 832 | .llvm_name = "zcmt", | 832 | .llvm_name = "zcmt", |
| 833 | .description = "'Zcmt' (table jump instuctions for code-size reduction)", | 833 | .description = "'Zcmt' (table jump instructions for code-size reduction)", |
| 834 | .dependencies = featureSet(&[_]Feature{ | 834 | .dependencies = featureSet(&[_]Feature{ |
| 835 | .zca, | 835 | .zca, |
| 836 | .zicsr, | 836 | .zicsr, |
lib/std/array_list.zig+4-4| ... | @@ -170,7 +170,7 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?u29) type { | ... | @@ -170,7 +170,7 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?u29) type { |
| 170 | /// operations. | 170 | /// operations. |
| 171 | /// Invalidates pre-existing pointers to elements at and after `index`. | 171 | /// Invalidates pre-existing pointers to elements at and after `index`. |
| 172 | /// Invalidates all pre-existing element pointers if capacity must be | 172 | /// Invalidates all pre-existing element pointers if capacity must be |
| 173 | /// increased to accomodate the new elements. | 173 | /// increased to accommodate the new elements. |
| 174 | /// Asserts that the index is in bounds or equal to the length. | 174 | /// Asserts that the index is in bounds or equal to the length. |
| 175 | pub fn addManyAt(self: *Self, index: usize, count: usize) Allocator.Error![]T { | 175 | pub fn addManyAt(self: *Self, index: usize, count: usize) Allocator.Error![]T { |
| 176 | const new_len = try addOrOom(self.items.len, count); | 176 | const new_len = try addOrOom(self.items.len, count); |
| ... | @@ -227,7 +227,7 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?u29) type { | ... | @@ -227,7 +227,7 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?u29) type { |
| 227 | /// This operation is O(N). | 227 | /// This operation is O(N). |
| 228 | /// Invalidates pre-existing pointers to elements at and after `index`. | 228 | /// Invalidates pre-existing pointers to elements at and after `index`. |
| 229 | /// Invalidates all pre-existing element pointers if capacity must be | 229 | /// Invalidates all pre-existing element pointers if capacity must be |
| 230 | /// increased to accomodate the new elements. | 230 | /// increased to accommodate the new elements. |
| 231 | /// Asserts that the index is in bounds or equal to the length. | 231 | /// Asserts that the index is in bounds or equal to the length. |
| 232 | pub fn insertSlice( | 232 | pub fn insertSlice( |
| 233 | self: *Self, | 233 | self: *Self, |
| ... | @@ -740,7 +740,7 @@ pub fn ArrayListAlignedUnmanaged(comptime T: type, comptime alignment: ?u29) typ | ... | @@ -740,7 +740,7 @@ pub fn ArrayListAlignedUnmanaged(comptime T: type, comptime alignment: ?u29) typ |
| 740 | /// operations. | 740 | /// operations. |
| 741 | /// Invalidates pre-existing pointers to elements at and after `index`. | 741 | /// Invalidates pre-existing pointers to elements at and after `index`. |
| 742 | /// Invalidates all pre-existing element pointers if capacity must be | 742 | /// Invalidates all pre-existing element pointers if capacity must be |
| 743 | /// increased to accomodate the new elements. | 743 | /// increased to accommodate the new elements. |
| 744 | /// Asserts that the index is in bounds or equal to the length. | 744 | /// Asserts that the index is in bounds or equal to the length. |
| 745 | pub fn addManyAt( | 745 | pub fn addManyAt( |
| 746 | self: *Self, | 746 | self: *Self, |
| ... | @@ -776,7 +776,7 @@ pub fn ArrayListAlignedUnmanaged(comptime T: type, comptime alignment: ?u29) typ | ... | @@ -776,7 +776,7 @@ pub fn ArrayListAlignedUnmanaged(comptime T: type, comptime alignment: ?u29) typ |
| 776 | /// This operation is O(N). | 776 | /// This operation is O(N). |
| 777 | /// Invalidates pre-existing pointers to elements at and after `index`. | 777 | /// Invalidates pre-existing pointers to elements at and after `index`. |
| 778 | /// Invalidates all pre-existing element pointers if capacity must be | 778 | /// Invalidates all pre-existing element pointers if capacity must be |
| 779 | /// increased to accomodate the new elements. | 779 | /// increased to accommodate the new elements. |
| 780 | /// Asserts that the index is in bounds or equal to the length. | 780 | /// Asserts that the index is in bounds or equal to the length. |
| 781 | pub fn insertSlice( | 781 | pub fn insertSlice( |
| 782 | self: *Self, | 782 | self: *Self, |
lib/std/c/darwin.zig+1-1| ... | @@ -2523,7 +2523,7 @@ pub const F = struct { | ... | @@ -2523,7 +2523,7 @@ pub const F = struct { |
| 2523 | /// add signature from same file (used by dyld for shared libs) | 2523 | /// add signature from same file (used by dyld for shared libs) |
| 2524 | pub const ADDFILESIGS = 61; | 2524 | pub const ADDFILESIGS = 61; |
| 2525 | /// used in conjunction with F.NOCACHE to indicate that DIRECT, synchronous writes | 2525 | /// used in conjunction with F.NOCACHE to indicate that DIRECT, synchronous writes |
| 2526 | /// should not be used (i.e. its ok to temporaily create cached pages) | 2526 | /// should not be used (i.e. its ok to temporarily create cached pages) |
| 2527 | pub const NODIRECT = 62; | 2527 | pub const NODIRECT = 62; |
| 2528 | ///Get the protection class of a file from the EA, returns int | 2528 | ///Get the protection class of a file from the EA, returns int |
| 2529 | pub const GETPROTECTIONCLASS = 63; | 2529 | pub const GETPROTECTIONCLASS = 63; |
lib/std/coff.zig+1-1| ... | @@ -581,7 +581,7 @@ pub const SectionHeaderFlags = packed struct { | ... | @@ -581,7 +581,7 @@ pub const SectionHeaderFlags = packed struct { |
| 581 | /// This is valid for object files only. | 581 | /// This is valid for object files only. |
| 582 | LNK_INFO: u1 = 0, | 582 | LNK_INFO: u1 = 0, |
| 583 | 583 | ||
| 584 | _reserverd_2: u1 = 0, | 584 | _reserved_2: u1 = 0, |
| 585 | 585 | ||
| 586 | /// The section will not become part of the image. | 586 | /// The section will not become part of the image. |
| 587 | /// This is valid only for object files. | 587 | /// This is valid only for object files. |
lib/std/compress/flate.zig+2-2| ... | @@ -70,8 +70,8 @@ pub const store = struct { | ... | @@ -70,8 +70,8 @@ pub const store = struct { |
| 70 | } | 70 | } |
| 71 | }; | 71 | }; |
| 72 | 72 | ||
| 73 | /// Container defines header/footer arround deflate bit stream. Gzip and zlib | 73 | /// Container defines header/footer around deflate bit stream. Gzip and zlib |
| 74 | /// compression algorithms are containers arround deflate bit stream body. | 74 | /// compression algorithms are containers around deflate bit stream body. |
| 75 | const Container = @import("flate/container.zig").Container; | 75 | const Container = @import("flate/container.zig").Container; |
| 76 | const std = @import("std"); | 76 | const std = @import("std"); |
| 77 | const testing = std.testing; | 77 | const testing = std.testing; |
lib/std/compress/flate/CircularBuffer.zig+1-1| ... | @@ -109,7 +109,7 @@ const ReadBlock = struct { | ... | @@ -109,7 +109,7 @@ const ReadBlock = struct { |
| 109 | len: usize, | 109 | len: usize, |
| 110 | }; | 110 | }; |
| 111 | 111 | ||
| 112 | /// Returns position of continous read block data. | 112 | /// Returns position of continuous read block data. |
| 113 | fn readBlock(self: *Self, max: usize) ReadBlock { | 113 | fn readBlock(self: *Self, max: usize) ReadBlock { |
| 114 | const r = self.rp & mask; | 114 | const r = self.rp & mask; |
| 115 | const w = self.wp & mask; | 115 | const w = self.wp & mask; |
lib/std/compress/flate/Lookup.zig+1-1| ... | @@ -26,7 +26,7 @@ pub fn add(self: *Self, data: []const u8, pos: u16) u16 { | ... | @@ -26,7 +26,7 @@ pub fn add(self: *Self, data: []const u8, pos: u16) u16 { |
| 26 | return self.set(h, pos); | 26 | return self.set(h, pos); |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | // Retruns previous location with the same hash value given the current | 29 | // Returns previous location with the same hash value given the current |
| 30 | // position. | 30 | // position. |
| 31 | pub fn prev(self: *Self, pos: u16) u16 { | 31 | pub fn prev(self: *Self, pos: u16) u16 { |
| 32 | return self.chain[pos]; | 32 | return self.chain[pos]; |
lib/std/compress/flate/SlidingWindow.zig+1-1| ... | @@ -84,7 +84,7 @@ pub fn match(self: *Self, prev_pos: u16, curr_pos: u16, min_len: u16) u16 { | ... | @@ -84,7 +84,7 @@ pub fn match(self: *Self, prev_pos: u16, curr_pos: u16, min_len: u16) u16 { |
| 84 | const prev_lh = self.buffer[prev_pos..][0..max_len]; | 84 | const prev_lh = self.buffer[prev_pos..][0..max_len]; |
| 85 | const curr_lh = self.buffer[curr_pos..][0..max_len]; | 85 | const curr_lh = self.buffer[curr_pos..][0..max_len]; |
| 86 | 86 | ||
| 87 | // If we alread have match (min_len > 0), | 87 | // If we already have match (min_len > 0), |
| 88 | // test the first byte above previous len a[min_len] != b[min_len] | 88 | // test the first byte above previous len a[min_len] != b[min_len] |
| 89 | // and then all the bytes from that position to zero. | 89 | // and then all the bytes from that position to zero. |
| 90 | // That is likely positions to find difference than looping from first bytes. | 90 | // That is likely positions to find difference than looping from first bytes. |
lib/std/compress/flate/Token.zig+1-1| ... | @@ -110,7 +110,7 @@ pub fn show(t: Token) void { | ... | @@ -110,7 +110,7 @@ pub fn show(t: Token) void { |
| 110 | } | 110 | } |
| 111 | } | 111 | } |
| 112 | 112 | ||
| 113 | // Retruns index in match_lengths table for each length in range 0-255. | 113 | // Returns index in match_lengths table for each length in range 0-255. |
| 114 | const match_lengths_index = [_]u8{ | 114 | const match_lengths_index = [_]u8{ |
| 115 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, | 115 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, |
| 116 | 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, | 116 | 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, |
lib/std/compress/flate/bit_reader.zig+4-4| ... | @@ -57,7 +57,7 @@ pub fn BitReader(comptime T: type, comptime ReaderType: type) type { | ... | @@ -57,7 +57,7 @@ pub fn BitReader(comptime T: type, comptime ReaderType: type) type { |
| 57 | /// it may be some extra zero bits in buffer. | 57 | /// it may be some extra zero bits in buffer. |
| 58 | pub inline fn fill(self: *Self, nice: u6) !void { | 58 | pub inline fn fill(self: *Self, nice: u6) !void { |
| 59 | if (self.nbits >= nice and nice != 0) { | 59 | if (self.nbits >= nice and nice != 0) { |
| 60 | return; // We have enought bits | 60 | return; // We have enough bits |
| 61 | } | 61 | } |
| 62 | // Read more bits from forward reader | 62 | // Read more bits from forward reader |
| 63 | 63 | ||
| ... | @@ -96,7 +96,7 @@ pub fn BitReader(comptime T: type, comptime ReaderType: type) type { | ... | @@ -96,7 +96,7 @@ pub fn BitReader(comptime T: type, comptime ReaderType: type) type { |
| 96 | pub const flag = struct { | 96 | pub const flag = struct { |
| 97 | pub const peek: u3 = 0b001; // dont advance internal buffer, just get bits, leave them in buffer | 97 | pub const peek: u3 = 0b001; // dont advance internal buffer, just get bits, leave them in buffer |
| 98 | pub const buffered: u3 = 0b010; // assume that there is no need to fill, fill should be called before | 98 | pub const buffered: u3 = 0b010; // assume that there is no need to fill, fill should be called before |
| 99 | pub const reverse: u3 = 0b100; // bit reverse readed bits | 99 | pub const reverse: u3 = 0b100; // bit reverse read bits |
| 100 | }; | 100 | }; |
| 101 | 101 | ||
| 102 | /// Alias for readF(U, 0). | 102 | /// Alias for readF(U, 0). |
| ... | @@ -133,7 +133,7 @@ pub fn BitReader(comptime T: type, comptime ReaderType: type) type { | ... | @@ -133,7 +133,7 @@ pub fn BitReader(comptime T: type, comptime ReaderType: type) type { |
| 133 | try self.fill(n); | 133 | try self.fill(n); |
| 134 | return @truncate(self.bits); | 134 | return @truncate(self.bits); |
| 135 | }, | 135 | }, |
| 136 | flag.buffered => { // no fill, assume that buffer has enought bits | 136 | flag.buffered => { // no fill, assume that buffer has enough bits |
| 137 | const u: U = @truncate(self.bits); | 137 | const u: U = @truncate(self.bits); |
| 138 | try self.shift(n); | 138 | try self.shift(n); |
| 139 | return u; | 139 | return u; |
| ... | @@ -212,7 +212,7 @@ pub fn BitReader(comptime T: type, comptime ReaderType: type) type { | ... | @@ -212,7 +212,7 @@ pub fn BitReader(comptime T: type, comptime ReaderType: type) type { |
| 212 | } | 212 | } |
| 213 | 213 | ||
| 214 | /// Read deflate fixed fixed code. | 214 | /// Read deflate fixed fixed code. |
| 215 | /// Reads first 7 bits, and then mybe 1 or 2 more to get full 7,8 or 9 bit code. | 215 | /// Reads first 7 bits, and then maybe 1 or 2 more to get full 7,8 or 9 bit code. |
| 216 | /// ref: https://datatracker.ietf.org/doc/html/rfc1951#page-12 | 216 | /// ref: https://datatracker.ietf.org/doc/html/rfc1951#page-12 |
| 217 | /// Lit Value Bits Codes | 217 | /// Lit Value Bits Codes |
| 218 | /// --------- ---- ----- | 218 | /// --------- ---- ----- |
lib/std/compress/flate/block_writer.zig+1-1| ... | @@ -48,7 +48,7 @@ pub fn BlockWriter(comptime WriterType: type) type { | ... | @@ -48,7 +48,7 @@ pub fn BlockWriter(comptime WriterType: type) type { |
| 48 | /// Should be called only when bit stream is at byte boundary. | 48 | /// Should be called only when bit stream is at byte boundary. |
| 49 | /// | 49 | /// |
| 50 | /// That is after final block; when last byte could be incomplete or | 50 | /// That is after final block; when last byte could be incomplete or |
| 51 | /// after stored block; which is aligned to the byte bounday (it has x | 51 | /// after stored block; which is aligned to the byte boundary (it has x |
| 52 | /// padding bits after first 3 bits). | 52 | /// padding bits after first 3 bits). |
| 53 | pub fn flush(self: *Self) Error!void { | 53 | pub fn flush(self: *Self) Error!void { |
| 54 | try self.bit_writer.flush(); | 54 | try self.bit_writer.flush(); |
lib/std/compress/flate/consts.zig+1-1| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | pub const deflate = struct { | 1 | pub const deflate = struct { |
| 2 | // Number of tokens to accumlate in deflate before starting block encoding. | 2 | // Number of tokens to accumulate in deflate before starting block encoding. |
| 3 | // | 3 | // |
| 4 | // In zlib this depends on memlevel: 6 + memlevel, where default memlevel is | 4 | // In zlib this depends on memlevel: 6 + memlevel, where default memlevel is |
| 5 | // 8 and max 9 that gives 14 or 15 bits. | 5 | // 8 and max 9 that gives 14 or 15 bits. |
lib/std/compress/flate/deflate.zig+5-5| ... | @@ -183,7 +183,7 @@ fn Deflate(comptime container: Container, comptime WriterType: type, comptime Bl | ... | @@ -183,7 +183,7 @@ fn Deflate(comptime container: Container, comptime WriterType: type, comptime Bl |
| 183 | // Write match from previous position. | 183 | // Write match from previous position. |
| 184 | step = try self.addMatch(m) - 1; // we already advanced 1 from previous position | 184 | step = try self.addMatch(m) - 1; // we already advanced 1 from previous position |
| 185 | } else { | 185 | } else { |
| 186 | // No match at previous postition. | 186 | // No match at previous position. |
| 187 | // Write previous literal if any, and remember this literal. | 187 | // Write previous literal if any, and remember this literal. |
| 188 | try self.addPrevLiteral(); | 188 | try self.addPrevLiteral(); |
| 189 | self.prev_literal = literal; | 189 | self.prev_literal = literal; |
| ... | @@ -268,9 +268,9 @@ fn Deflate(comptime container: Container, comptime WriterType: type, comptime Bl | ... | @@ -268,9 +268,9 @@ fn Deflate(comptime container: Container, comptime WriterType: type, comptime Bl |
| 268 | fn flushTokens(self: *Self, flush_opt: FlushOption) !void { | 268 | fn flushTokens(self: *Self, flush_opt: FlushOption) !void { |
| 269 | // Pass tokens to the token writer | 269 | // Pass tokens to the token writer |
| 270 | try self.block_writer.write(self.tokens.tokens(), flush_opt == .final, self.win.tokensBuffer()); | 270 | try self.block_writer.write(self.tokens.tokens(), flush_opt == .final, self.win.tokensBuffer()); |
| 271 | // Stored block ensures byte aligment. | 271 | // Stored block ensures byte alignment. |
| 272 | // It has 3 bits (final, block_type) and then padding until byte boundary. | 272 | // It has 3 bits (final, block_type) and then padding until byte boundary. |
| 273 | // After that everyting is aligned to the boundary in the stored block. | 273 | // After that everything is aligned to the boundary in the stored block. |
| 274 | // Empty stored block is Ob000 + (0-7) bits of padding + 0x00 0x00 0xFF 0xFF. | 274 | // Empty stored block is Ob000 + (0-7) bits of padding + 0x00 0x00 0xFF 0xFF. |
| 275 | // Last 4 bytes are byte aligned. | 275 | // Last 4 bytes are byte aligned. |
| 276 | if (flush_opt == .flush) { | 276 | if (flush_opt == .flush) { |
| ... | @@ -572,7 +572,7 @@ test "tokenization" { | ... | @@ -572,7 +572,7 @@ test "tokenization" { |
| 572 | } | 572 | } |
| 573 | } | 573 | } |
| 574 | 574 | ||
| 575 | // Tests that tokens writen are equal to expected token list. | 575 | // Tests that tokens written are equal to expected token list. |
| 576 | const TestTokenWriter = struct { | 576 | const TestTokenWriter = struct { |
| 577 | const Self = @This(); | 577 | const Self = @This(); |
| 578 | 578 | ||
| ... | @@ -655,7 +655,7 @@ test "file tokenization" { | ... | @@ -655,7 +655,7 @@ test "file tokenization" { |
| 655 | const TokenWriter = TokenDecoder(@TypeOf(writer)); | 655 | const TokenWriter = TokenDecoder(@TypeOf(writer)); |
| 656 | var cmp = try Deflate(.raw, WriterType, TokenWriter).init(writer, .{ .level = level }); | 656 | var cmp = try Deflate(.raw, WriterType, TokenWriter).init(writer, .{ .level = level }); |
| 657 | 657 | ||
| 658 | // Stream uncompressed `orignal` data to the compressor. It will | 658 | // Stream uncompressed `original` data to the compressor. It will |
| 659 | // produce tokens list and pass that list to the TokenDecoder. This | 659 | // produce tokens list and pass that list to the TokenDecoder. This |
| 660 | // TokenDecoder uses CircularBuffer from inflate to convert list of | 660 | // TokenDecoder uses CircularBuffer from inflate to convert list of |
| 661 | // tokens back to the uncompressed stream. | 661 | // tokens back to the uncompressed stream. |
lib/std/compress/flate/huffman_decoder.zig+3-3| ... | @@ -132,7 +132,7 @@ fn HuffmanDecoder( | ... | @@ -132,7 +132,7 @@ fn HuffmanDecoder( |
| 132 | if (n > max) max = n; | 132 | if (n > max) max = n; |
| 133 | count[n] += 1; | 133 | count[n] += 1; |
| 134 | } | 134 | } |
| 135 | if (max == 0) // emtpy tree | 135 | if (max == 0) // empty tree |
| 136 | return; | 136 | return; |
| 137 | 137 | ||
| 138 | // check for an over-subscribed or incomplete set of lengths | 138 | // check for an over-subscribed or incomplete set of lengths |
| ... | @@ -255,7 +255,7 @@ test "encode/decode literals" { | ... | @@ -255,7 +255,7 @@ test "encode/decode literals" { |
| 255 | 255 | ||
| 256 | for (1..286) |j| { // for all different number of codes | 256 | for (1..286) |j| { // for all different number of codes |
| 257 | var enc: LiteralEncoder = .{}; | 257 | var enc: LiteralEncoder = .{}; |
| 258 | // create freqencies | 258 | // create frequencies |
| 259 | var freq = [_]u16{0} ** 286; | 259 | var freq = [_]u16{0} ** 286; |
| 260 | freq[256] = 1; // ensure we have end of block code | 260 | freq[256] = 1; // ensure we have end of block code |
| 261 | for (&freq, 1..) |*f, i| { | 261 | for (&freq, 1..) |*f, i| { |
| ... | @@ -263,7 +263,7 @@ test "encode/decode literals" { | ... | @@ -263,7 +263,7 @@ test "encode/decode literals" { |
| 263 | f.* = @intCast(i); | 263 | f.* = @intCast(i); |
| 264 | } | 264 | } |
| 265 | 265 | ||
| 266 | // encoder from freqencies | 266 | // encoder from frequencies |
| 267 | enc.generate(&freq, 15); | 267 | enc.generate(&freq, 15); |
| 268 | 268 | ||
| 269 | // get code_lens from encoder | 269 | // get code_lens from encoder |
lib/std/compress/flate/huffman_encoder.zig+1-1| ... | @@ -168,7 +168,7 @@ pub fn HuffmanEncoder(comptime size: usize) type { | ... | @@ -168,7 +168,7 @@ pub fn HuffmanEncoder(comptime size: usize) type { |
| 168 | while (true) { | 168 | while (true) { |
| 169 | var l = &levels[level]; | 169 | var l = &levels[level]; |
| 170 | if (l.next_pair_freq == math.maxInt(i32) and l.next_char_freq == math.maxInt(i32)) { | 170 | if (l.next_pair_freq == math.maxInt(i32) and l.next_char_freq == math.maxInt(i32)) { |
| 171 | // We've run out of both leafs and pairs. | 171 | // We've run out of both leaves and pairs. |
| 172 | // End all calculations for this level. | 172 | // End all calculations for this level. |
| 173 | // To make sure we never come back to this level or any lower level, | 173 | // To make sure we never come back to this level or any lower level, |
| 174 | // set next_pair_freq impossibly large. | 174 | // set next_pair_freq impossibly large. |
lib/std/compress/flate/inflate.zig+3-3| ... | @@ -99,7 +99,7 @@ pub fn Inflate(comptime container: Container, comptime LookaheadType: type, comp | ... | @@ -99,7 +99,7 @@ pub fn Inflate(comptime container: Container, comptime LookaheadType: type, comp |
| 99 | 99 | ||
| 100 | fn storedBlock(self: *Self) !bool { | 100 | fn storedBlock(self: *Self) !bool { |
| 101 | self.bits.alignToByte(); // skip padding until byte boundary | 101 | self.bits.alignToByte(); // skip padding until byte boundary |
| 102 | // everyting after this is byte aligned in stored block | 102 | // everything after this is byte aligned in stored block |
| 103 | var len = try self.bits.read(u16); | 103 | var len = try self.bits.read(u16); |
| 104 | const nlen = try self.bits.read(u16); | 104 | const nlen = try self.bits.read(u16); |
| 105 | if (len != ~nlen) return error.WrongStoredBlockNlen; | 105 | if (len != ~nlen) return error.WrongStoredBlockNlen; |
| ... | @@ -155,7 +155,7 @@ pub fn Inflate(comptime container: Container, comptime LookaheadType: type, comp | ... | @@ -155,7 +155,7 @@ pub fn Inflate(comptime container: Container, comptime LookaheadType: type, comp |
| 155 | fn dynamicBlockHeader(self: *Self) !void { | 155 | fn dynamicBlockHeader(self: *Self) !void { |
| 156 | const hlit: u16 = @as(u16, try self.bits.read(u5)) + 257; // number of ll code entries present - 257 | 156 | const hlit: u16 = @as(u16, try self.bits.read(u5)) + 257; // number of ll code entries present - 257 |
| 157 | const hdist: u16 = @as(u16, try self.bits.read(u5)) + 1; // number of distance code entries - 1 | 157 | const hdist: u16 = @as(u16, try self.bits.read(u5)) + 1; // number of distance code entries - 1 |
| 158 | const hclen: u8 = @as(u8, try self.bits.read(u4)) + 4; // hclen + 4 code lenths are encoded | 158 | const hclen: u8 = @as(u8, try self.bits.read(u4)) + 4; // hclen + 4 code lengths are encoded |
| 159 | 159 | ||
| 160 | if (hlit > 286 or hdist > 30) | 160 | if (hlit > 286 or hdist > 30) |
| 161 | return error.InvalidDynamicBlockHeader; | 161 | return error.InvalidDynamicBlockHeader; |
| ... | @@ -180,7 +180,7 @@ pub fn Inflate(comptime container: Container, comptime LookaheadType: type, comp | ... | @@ -180,7 +180,7 @@ pub fn Inflate(comptime container: Container, comptime LookaheadType: type, comp |
| 180 | return error.InvalidDynamicBlockHeader; | 180 | return error.InvalidDynamicBlockHeader; |
| 181 | } | 181 | } |
| 182 | 182 | ||
| 183 | // literal code lengts to literal decoder | 183 | // literal code lengths to literal decoder |
| 184 | try self.lit_dec.generate(dec_lens[0..hlit]); | 184 | try self.lit_dec.generate(dec_lens[0..hlit]); |
| 185 | 185 | ||
| 186 | // distance code lengths to distance decoder | 186 | // distance code lengths to distance decoder |
lib/std/crypto/Certificate.zig+1-1| ... | @@ -977,7 +977,7 @@ pub const rsa = struct { | ... | @@ -977,7 +977,7 @@ pub const rsa = struct { |
| 977 | // the hash function (2^61 - 1 octets for SHA-1), output | 977 | // the hash function (2^61 - 1 octets for SHA-1), output |
| 978 | // "inconsistent" and stop. | 978 | // "inconsistent" and stop. |
| 979 | // All the cryptographic hash functions in the standard library have a limit of >= 2^61 - 1. | 979 | // All the cryptographic hash functions in the standard library have a limit of >= 2^61 - 1. |
| 980 | // Even then, this check is only there for paranoia. In the context of TLS certifcates, emBit cannot exceed 4096. | 980 | // Even then, this check is only there for paranoia. In the context of TLS certificates, emBit cannot exceed 4096. |
| 981 | if (emBit >= 1 << 61) return error.InvalidSignature; | 981 | if (emBit >= 1 << 61) return error.InvalidSignature; |
| 982 | 982 | ||
| 983 | // emLen = \ceil(emBits/8) | 983 | // emLen = \ceil(emBits/8) |
lib/std/crypto/ff.zig+1-1| ... | @@ -41,7 +41,7 @@ pub const OverflowError = error{Overflow}; | ... | @@ -41,7 +41,7 @@ pub const OverflowError = error{Overflow}; |
| 41 | /// Invalid modulus. Modulus must be odd. | 41 | /// Invalid modulus. Modulus must be odd. |
| 42 | pub const InvalidModulusError = error{ EvenModulus, ModulusTooSmall }; | 42 | pub const InvalidModulusError = error{ EvenModulus, ModulusTooSmall }; |
| 43 | 43 | ||
| 44 | /// Exponentation with a null exponent. | 44 | /// Exponentiation with a null exponent. |
| 45 | /// Exponentiation in cryptographic protocols is almost always a sign of a bug which can lead to trivial attacks. | 45 | /// Exponentiation in cryptographic protocols is almost always a sign of a bug which can lead to trivial attacks. |
| 46 | /// Therefore, this module returns an error when a null exponent is encountered, encouraging applications to handle this case explicitly. | 46 | /// Therefore, this module returns an error when a null exponent is encountered, encouraging applications to handle this case explicitly. |
| 47 | pub const NullExponentError = error{NullExponent}; | 47 | pub const NullExponentError = error{NullExponent}; |
lib/std/crypto/ml_kem.zig+2-2| ... | @@ -379,7 +379,7 @@ fn Kyber(comptime p: Params) type { | ... | @@ -379,7 +379,7 @@ fn Kyber(comptime p: Params) type { |
| 379 | 379 | ||
| 380 | /// Create a new key pair. | 380 | /// Create a new key pair. |
| 381 | /// If seed is null, a random seed will be generated. | 381 | /// If seed is null, a random seed will be generated. |
| 382 | /// If a seed is provided, the key pair will be determinsitic. | 382 | /// If a seed is provided, the key pair will be deterministic. |
| 383 | pub fn create(seed_: ?[seed_length]u8) !KeyPair { | 383 | pub fn create(seed_: ?[seed_length]u8) !KeyPair { |
| 384 | const seed = seed_ orelse sk: { | 384 | const seed = seed_ orelse sk: { |
| 385 | var random_seed: [seed_length]u8 = undefined; | 385 | var random_seed: [seed_length]u8 = undefined; |
| ... | @@ -1253,7 +1253,7 @@ const Poly = struct { | ... | @@ -1253,7 +1253,7 @@ const Poly = struct { |
| 1253 | t |= @as(T, buf[batch_bytes * i + j]) << (8 * j); | 1253 | t |= @as(T, buf[batch_bytes * i + j]) << (8 * j); |
| 1254 | } | 1254 | } |
| 1255 | 1255 | ||
| 1256 | // Accumelate `a's and `b's together by masking them out, shifting | 1256 | // Accumulate `a's and `b's together by masking them out, shifting |
| 1257 | // and adding. For η=3, we have d = a₁ + a₂ + a₃ + 8(b₁ + b₂ + b₃) + … | 1257 | // and adding. For η=3, we have d = a₁ + a₂ + a₃ + 8(b₁ + b₂ + b₃) + … |
| 1258 | var d: T = 0; | 1258 | var d: T = 0; |
| 1259 | inline for (0..eta) |j| { | 1259 | inline for (0..eta) |j| { |
lib/std/crypto/salsa20.zig+1-1| ... | @@ -487,7 +487,7 @@ pub const Box = struct { | ... | @@ -487,7 +487,7 @@ pub const Box = struct { |
| 487 | /// A key pair. | 487 | /// A key pair. |
| 488 | pub const KeyPair = X25519.KeyPair; | 488 | pub const KeyPair = X25519.KeyPair; |
| 489 | 489 | ||
| 490 | /// Compute a secret suitable for `secretbox` given a recipent's public key and a sender's secret key. | 490 | /// Compute a secret suitable for `secretbox` given a recipient's public key and a sender's secret key. |
| 491 | pub fn createSharedSecret(public_key: [public_length]u8, secret_key: [secret_length]u8) (IdentityElementError || WeakPublicKeyError)![shared_length]u8 { | 491 | pub fn createSharedSecret(public_key: [public_length]u8, secret_key: [secret_length]u8) (IdentityElementError || WeakPublicKeyError)![shared_length]u8 { |
| 492 | const p = try X25519.scalarmult(secret_key, public_key); | 492 | const p = try X25519.scalarmult(secret_key, public_key); |
| 493 | const zero = [_]u8{0} ** 16; | 493 | const zero = [_]u8{0} ** 16; |
lib/std/crypto/sha2.zig+1-1| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | //! Secure Hashing Algorithm 2 (SHA2) | 1 | //! Secure Hashing Algorithm 2 (SHA2) |
| 2 | //! | 2 | //! |
| 3 | //! Published by the National Institue of Standards and Technology (NIST) [1] [2]. | 3 | //! Published by the National Institute of Standards and Technology (NIST) [1] [2]. |
| 4 | //! | 4 | //! |
| 5 | //! Truncation mitigates length-extension attacks but increases vulnerability to collision | 5 | //! Truncation mitigates length-extension attacks but increases vulnerability to collision |
| 6 | //! attacks. Collision attacks remain impractical for all types defined here. | 6 | //! attacks. Collision attacks remain impractical for all types defined here. |
lib/std/crypto/tls.zig+2-2| ... | @@ -40,8 +40,8 @@ const assert = std.debug.assert; | ... | @@ -40,8 +40,8 @@ const assert = std.debug.assert; |
| 40 | pub const Client = @import("tls/Client.zig"); | 40 | pub const Client = @import("tls/Client.zig"); |
| 41 | 41 | ||
| 42 | pub const record_header_len = 5; | 42 | pub const record_header_len = 5; |
| 43 | pub const max_cipertext_inner_record_len = 1 << 14; | 43 | pub const max_ciphertext_inner_record_len = 1 << 14; |
| 44 | pub const max_ciphertext_len = max_cipertext_inner_record_len + 256; | 44 | pub const max_ciphertext_len = max_ciphertext_inner_record_len + 256; |
| 45 | pub const max_ciphertext_record_len = max_ciphertext_len + record_header_len; | 45 | pub const max_ciphertext_record_len = max_ciphertext_len + record_header_len; |
| 46 | pub const hello_retry_request_sequence = [32]u8{ | 46 | pub const hello_retry_request_sequence = [32]u8{ |
| 47 | 0xCF, 0x21, 0xAD, 0x74, 0xE5, 0x9A, 0x61, 0x11, 0xBE, 0x1D, 0x8C, 0x02, 0x1E, 0x65, 0xB8, 0x91, | 47 | 0xCF, 0x21, 0xAD, 0x74, 0xE5, 0x9A, 0x61, 0x11, 0xBE, 0x1D, 0x8C, 0x02, 0x1E, 0x65, 0xB8, 0x91, |
lib/std/crypto/tls/Client.zig+1-1| ... | @@ -819,7 +819,7 @@ fn prepareCiphertextRecord( | ... | @@ -819,7 +819,7 @@ fn prepareCiphertextRecord( |
| 819 | const close_notify_alert_reserved = tls.close_notify_alert.len + overhead_len; | 819 | const close_notify_alert_reserved = tls.close_notify_alert.len + overhead_len; |
| 820 | while (true) { | 820 | while (true) { |
| 821 | const encrypted_content_len: u16 = @intCast(@min( | 821 | const encrypted_content_len: u16 = @intCast(@min( |
| 822 | @min(bytes.len - bytes_i, tls.max_cipertext_inner_record_len), | 822 | @min(bytes.len - bytes_i, tls.max_ciphertext_inner_record_len), |
| 823 | ciphertext_buf.len -| | 823 | ciphertext_buf.len -| |
| 824 | (close_notify_alert_reserved + overhead_len + ciphertext_end), | 824 | (close_notify_alert_reserved + overhead_len + ciphertext_end), |
| 825 | )); | 825 | )); |
lib/std/dwarf/abi.zig+1-1| ... | @@ -38,7 +38,7 @@ pub fn ipRegNum() u8 { | ... | @@ -38,7 +38,7 @@ pub fn ipRegNum() u8 { |
| 38 | 38 | ||
| 39 | pub fn fpRegNum(reg_context: RegisterContext) u8 { | 39 | pub fn fpRegNum(reg_context: RegisterContext) u8 { |
| 40 | return switch (builtin.cpu.arch) { | 40 | return switch (builtin.cpu.arch) { |
| 41 | // GCC on OS X historicaly did the opposite of ELF for these registers (only in .eh_frame), and that is now the convention for MachO | 41 | // GCC on OS X historically did the opposite of ELF for these registers (only in .eh_frame), and that is now the convention for MachO |
| 42 | .x86 => if (reg_context.eh_frame and reg_context.is_macho) 4 else 5, | 42 | .x86 => if (reg_context.eh_frame and reg_context.is_macho) 4 else 5, |
| 43 | .x86_64 => 6, | 43 | .x86_64 => 6, |
| 44 | .arm => 11, | 44 | .arm => 11, |
lib/std/dwarf/expressions.zig+3-3| ... | @@ -15,7 +15,7 @@ pub const ExpressionContext = struct { | ... | @@ -15,7 +15,7 @@ pub const ExpressionContext = struct { |
| 15 | /// The dwarf format of the section this expression is in | 15 | /// The dwarf format of the section this expression is in |
| 16 | format: dwarf.Format = .@"32", | 16 | format: dwarf.Format = .@"32", |
| 17 | 17 | ||
| 18 | /// If specified, any addresses will pass through this function before being acccessed | 18 | /// If specified, any addresses will pass through this function before being accessed |
| 19 | isValidMemory: ?*const fn (address: usize) bool = null, | 19 | isValidMemory: ?*const fn (address: usize) bool = null, |
| 20 | 20 | ||
| 21 | /// The compilation unit this expression relates to, if any | 21 | /// The compilation unit this expression relates to, if any |
| ... | @@ -42,14 +42,14 @@ pub const ExpressionOptions = struct { | ... | @@ -42,14 +42,14 @@ pub const ExpressionOptions = struct { |
| 42 | /// The address size of the target architecture | 42 | /// The address size of the target architecture |
| 43 | addr_size: u8 = @sizeOf(usize), | 43 | addr_size: u8 = @sizeOf(usize), |
| 44 | 44 | ||
| 45 | /// Endianess of the target architecture | 45 | /// Endianness of the target architecture |
| 46 | endian: std.builtin.Endian = builtin.target.cpu.arch.endian(), | 46 | endian: std.builtin.Endian = builtin.target.cpu.arch.endian(), |
| 47 | 47 | ||
| 48 | /// Restrict the stack machine to a subset of opcodes used in call frame instructions | 48 | /// Restrict the stack machine to a subset of opcodes used in call frame instructions |
| 49 | call_frame_context: bool = false, | 49 | call_frame_context: bool = false, |
| 50 | }; | 50 | }; |
| 51 | 51 | ||
| 52 | // Explcitly defined to support executing sub-expressions | 52 | // Explicitly defined to support executing sub-expressions |
| 53 | pub const ExpressionError = error{ | 53 | pub const ExpressionError = error{ |
| 54 | UnimplementedExpressionCall, | 54 | UnimplementedExpressionCall, |
| 55 | UnimplementedOpcode, | 55 | UnimplementedOpcode, |
lib/std/hash/crc/impl.zig+1-1| ... | @@ -1,4 +1,4 @@ | ... | @@ -1,4 +1,4 @@ |
| 1 | // There is a generic CRC implementation "Crc()" which can be paramterized via | 1 | // There is a generic CRC implementation "Crc()" which can be parameterized via |
| 2 | // the Algorithm struct for a plethora of uses. | 2 | // the Algorithm struct for a plethora of uses. |
| 3 | // | 3 | // |
| 4 | // The primary interface for all of the standard CRC algorithms is the | 4 | // The primary interface for all of the standard CRC algorithms is the |
lib/std/hash/wyhash.zig+1-1| ... | @@ -79,7 +79,7 @@ pub const Wyhash = struct { | ... | @@ -79,7 +79,7 @@ pub const Wyhash = struct { |
| 79 | @memcpy(scratch[0..rem], self.buf[self.buf.len - rem ..][0..rem]); | 79 | @memcpy(scratch[0..rem], self.buf[self.buf.len - rem ..][0..rem]); |
| 80 | @memcpy(scratch[rem..][0..self.buf_len], self.buf[0..self.buf_len]); | 80 | @memcpy(scratch[rem..][0..self.buf_len], self.buf[0..self.buf_len]); |
| 81 | 81 | ||
| 82 | // Same as input but with additional bytes preceeding start in case of a short buffer | 82 | // Same as input but with additional bytes preceding start in case of a short buffer |
| 83 | input = &scratch; | 83 | input = &scratch; |
| 84 | offset = rem; | 84 | offset = rem; |
| 85 | } | 85 | } |
lib/std/meta.zig+1-1| ... | @@ -902,7 +902,7 @@ pub fn intToEnum(comptime EnumTag: type, tag_int: anytype) IntToEnumError!EnumTa | ... | @@ -902,7 +902,7 @@ pub fn intToEnum(comptime EnumTag: type, tag_int: anytype) IntToEnumError!EnumTa |
| 902 | return error.InvalidEnumTag; | 902 | return error.InvalidEnumTag; |
| 903 | } | 903 | } |
| 904 | 904 | ||
| 905 | // We don't direcly iterate over the fields of EnumTag, as that | 905 | // We don't directly iterate over the fields of EnumTag, as that |
| 906 | // would require an inline loop. Instead, we create an array of | 906 | // would require an inline loop. Instead, we create an array of |
| 907 | // values that is comptime-know, but can be iterated at runtime | 907 | // values that is comptime-know, but can be iterated at runtime |
| 908 | // without requiring an inline loop. This generates better | 908 | // without requiring an inline loop. This generates better |
lib/std/os/linux.zig+4-4| ... | @@ -570,7 +570,7 @@ pub fn futex_wake(uaddr: *const i32, futex_op: u32, val: i32) usize { | ... | @@ -570,7 +570,7 @@ pub fn futex_wake(uaddr: *const i32, futex_op: u32, val: i32) usize { |
| 570 | /// Returns the array index of one of the woken futexes. | 570 | /// Returns the array index of one of the woken futexes. |
| 571 | /// No further information is provided: any number of other futexes may also | 571 | /// No further information is provided: any number of other futexes may also |
| 572 | /// have been woken by the same event, and if more than one futex was woken, | 572 | /// have been woken by the same event, and if more than one futex was woken, |
| 573 | /// the retrned index may refer to any one of them. | 573 | /// the returned index may refer to any one of them. |
| 574 | /// (It is not necessaryily the futex with the smallest index, nor the one | 574 | /// (It is not necessaryily the futex with the smallest index, nor the one |
| 575 | /// most recently woken, nor...) | 575 | /// most recently woken, nor...) |
| 576 | pub fn futex2_waitv( | 576 | pub fn futex2_waitv( |
| ... | @@ -648,7 +648,7 @@ pub fn futex2_wake( | ... | @@ -648,7 +648,7 @@ pub fn futex2_wake( |
| 648 | pub fn futex2_requeue( | 648 | pub fn futex2_requeue( |
| 649 | /// Array describing the source and destination futex. | 649 | /// Array describing the source and destination futex. |
| 650 | waiters: [*]futex_waitv, | 650 | waiters: [*]futex_waitv, |
| 651 | /// Unsed. | 651 | /// Unused. |
| 652 | flags: u32, | 652 | flags: u32, |
| 653 | /// Number of futexes to wake. | 653 | /// Number of futexes to wake. |
| 654 | nr_wake: i32, | 654 | nr_wake: i32, |
| ... | @@ -6009,7 +6009,7 @@ else | ... | @@ -6009,7 +6009,7 @@ else |
| 6009 | /// values of this resource limit. | 6009 | /// values of this resource limit. |
| 6010 | NICE, | 6010 | NICE, |
| 6011 | 6011 | ||
| 6012 | /// Maximum realtime priority allowed for non-priviledged | 6012 | /// Maximum realtime priority allowed for non-privileged |
| 6013 | /// processes. | 6013 | /// processes. |
| 6014 | RTPRIO, | 6014 | RTPRIO, |
| 6015 | 6015 | ||
| ... | @@ -7228,7 +7228,7 @@ pub const futex_waitv = extern struct { | ... | @@ -7228,7 +7228,7 @@ pub const futex_waitv = extern struct { |
| 7228 | uaddr: u64, | 7228 | uaddr: u64, |
| 7229 | /// Flags for this waiter. | 7229 | /// Flags for this waiter. |
| 7230 | flags: u32, | 7230 | flags: u32, |
| 7231 | /// Reserved memeber to preserve alignment. | 7231 | /// Reserved member to preserve alignment. |
| 7232 | /// Should be 0. | 7232 | /// Should be 0. |
| 7233 | __reserved: u32, | 7233 | __reserved: u32, |
| 7234 | }; | 7234 | }; |
lib/std/os/linux/IoUring.zig+2-2| ... | @@ -3938,7 +3938,7 @@ test BufferGroup { | ... | @@ -3938,7 +3938,7 @@ test BufferGroup { |
| 3938 | 3938 | ||
| 3939 | // Server uses buffer group receive | 3939 | // Server uses buffer group receive |
| 3940 | { | 3940 | { |
| 3941 | // Submit recv operation, buffer will be choosen from buffer group | 3941 | // Submit recv operation, buffer will be chosen from buffer group |
| 3942 | _ = try buf_grp.recv(2, fds.server, 0); | 3942 | _ = try buf_grp.recv(2, fds.server, 0); |
| 3943 | const submitted = try ring.submit(); | 3943 | const submitted = try ring.submit(); |
| 3944 | try testing.expectEqual(1, submitted); | 3944 | try testing.expectEqual(1, submitted); |
| ... | @@ -3956,7 +3956,7 @@ test BufferGroup { | ... | @@ -3956,7 +3956,7 @@ test BufferGroup { |
| 3956 | // Get buffer from pool | 3956 | // Get buffer from pool |
| 3957 | const buf = buf_grp.get(buffer_id)[0..len]; | 3957 | const buf = buf_grp.get(buffer_id)[0..len]; |
| 3958 | try testing.expectEqualSlices(u8, &data, buf); | 3958 | try testing.expectEqualSlices(u8, &data, buf); |
| 3959 | // Releaase buffer to the kernel when application is done with it | 3959 | // Release buffer to the kernel when application is done with it |
| 3960 | buf_grp.put(buffer_id); | 3960 | buf_grp.put(buffer_id); |
| 3961 | } | 3961 | } |
| 3962 | } | 3962 | } |
lib/std/os/linux/bpf.zig+1-1| ... | @@ -140,7 +140,7 @@ pub const F_STRICT_ALIGNMENT = 0x1; | ... | @@ -140,7 +140,7 @@ pub const F_STRICT_ALIGNMENT = 0x1; |
| 140 | 140 | ||
| 141 | /// If BPF_F_ANY_ALIGNMENT is used in BPF_PROF_LOAD command, the verifier will | 141 | /// If BPF_F_ANY_ALIGNMENT is used in BPF_PROF_LOAD command, the verifier will |
| 142 | /// allow any alignment whatsoever. On platforms with strict alignment | 142 | /// allow any alignment whatsoever. On platforms with strict alignment |
| 143 | /// requirements for loads ands stores (such as sparc and mips) the verifier | 143 | /// requirements for loads and stores (such as sparc and mips) the verifier |
| 144 | /// validates that all loads and stores provably follow this requirement. This | 144 | /// validates that all loads and stores provably follow this requirement. This |
| 145 | /// flag turns that checking and enforcement off. | 145 | /// flag turns that checking and enforcement off. |
| 146 | /// | 146 | /// |
lib/std/os/linux/mips.zig+1-1| ... | @@ -385,7 +385,7 @@ pub const rlimit_resource = enum(c_int) { | ... | @@ -385,7 +385,7 @@ pub const rlimit_resource = enum(c_int) { |
| 385 | /// values of this resource limit. | 385 | /// values of this resource limit. |
| 386 | NICE, | 386 | NICE, |
| 387 | 387 | ||
| 388 | /// Maximum realtime priority allowed for non-priviledged | 388 | /// Maximum realtime priority allowed for non-privileged |
| 389 | /// processes. | 389 | /// processes. |
| 390 | RTPRIO, | 390 | RTPRIO, |
| 391 | 391 |
lib/std/os/linux/mips64.zig+1-1| ... | @@ -370,7 +370,7 @@ pub const rlimit_resource = enum(c_int) { | ... | @@ -370,7 +370,7 @@ pub const rlimit_resource = enum(c_int) { |
| 370 | /// values of this resource limit. | 370 | /// values of this resource limit. |
| 371 | NICE, | 371 | NICE, |
| 372 | 372 | ||
| 373 | /// Maximum realtime priority allowed for non-priviledged | 373 | /// Maximum realtime priority allowed for non-privileged |
| 374 | /// processes. | 374 | /// processes. |
| 375 | RTPRIO, | 375 | RTPRIO, |
| 376 | 376 |
lib/std/os/linux/sparc64.zig+1-1| ... | @@ -460,7 +460,7 @@ pub const rlimit_resource = enum(c_int) { | ... | @@ -460,7 +460,7 @@ pub const rlimit_resource = enum(c_int) { |
| 460 | /// values of this resource limit. | 460 | /// values of this resource limit. |
| 461 | NICE, | 461 | NICE, |
| 462 | 462 | ||
| 463 | /// Maximum realtime priority allowed for non-priviledged | 463 | /// Maximum realtime priority allowed for non-privileged |
| 464 | /// processes. | 464 | /// processes. |
| 465 | RTPRIO, | 465 | RTPRIO, |
| 466 | 466 |
lib/std/os/plan9.zig+1-1| ... | @@ -184,7 +184,7 @@ pub const SIG = struct { | ... | @@ -184,7 +184,7 @@ pub const SIG = struct { |
| 184 | pub const sigset_t = c_long; | 184 | pub const sigset_t = c_long; |
| 185 | pub const empty_sigset = 0; | 185 | pub const empty_sigset = 0; |
| 186 | pub const siginfo_t = c_long; | 186 | pub const siginfo_t = c_long; |
| 187 | // TODO plan9 doesn't have sigaction_fn. Sigaction is not a union, but we incude it here to be compatible. | 187 | // TODO plan9 doesn't have sigaction_fn. Sigaction is not a union, but we include it here to be compatible. |
| 188 | pub const Sigaction = extern struct { | 188 | pub const Sigaction = extern struct { |
| 189 | pub const handler_fn = *const fn (i32) callconv(.C) void; | 189 | pub const handler_fn = *const fn (i32) callconv(.C) void; |
| 190 | pub const sigaction_fn = *const fn (i32, *const siginfo_t, ?*anyopaque) callconv(.C) void; | 190 | pub const sigaction_fn = *const fn (i32, *const siginfo_t, ?*anyopaque) callconv(.C) void; |
lib/std/posix.zig+1-1| ... | @@ -3474,7 +3474,7 @@ pub const SocketError = error{ | ... | @@ -3474,7 +3474,7 @@ pub const SocketError = error{ |
| 3474 | pub fn socket(domain: u32, socket_type: u32, protocol: u32) SocketError!socket_t { | 3474 | pub fn socket(domain: u32, socket_type: u32, protocol: u32) SocketError!socket_t { |
| 3475 | if (native_os == .windows) { | 3475 | if (native_os == .windows) { |
| 3476 | // NOTE: windows translates the SOCK.NONBLOCK/SOCK.CLOEXEC flags into | 3476 | // NOTE: windows translates the SOCK.NONBLOCK/SOCK.CLOEXEC flags into |
| 3477 | // windows-analagous operations | 3477 | // windows-analogous operations |
| 3478 | const filtered_sock_type = socket_type & ~@as(u32, SOCK.NONBLOCK | SOCK.CLOEXEC); | 3478 | const filtered_sock_type = socket_type & ~@as(u32, SOCK.NONBLOCK | SOCK.CLOEXEC); |
| 3479 | const flags: u32 = if ((socket_type & SOCK.CLOEXEC) != 0) | 3479 | const flags: u32 = if ((socket_type & SOCK.CLOEXEC) != 0) |
| 3480 | windows.ws2_32.WSA_FLAG_NO_HANDLE_INHERIT | 3480 | windows.ws2_32.WSA_FLAG_NO_HANDLE_INHERIT |
lib/std/priority_queue.zig+1-1| ... | @@ -617,7 +617,7 @@ fn contextLessThan(context: []const u32, a: usize, b: usize) Order { | ... | @@ -617,7 +617,7 @@ fn contextLessThan(context: []const u32, a: usize, b: usize) Order { |
| 617 | 617 | ||
| 618 | const CPQlt = PriorityQueue(usize, []const u32, contextLessThan); | 618 | const CPQlt = PriorityQueue(usize, []const u32, contextLessThan); |
| 619 | 619 | ||
| 620 | test "add and remove min heap with contextful comparator" { | 620 | test "add and remove min heap with context comparator" { |
| 621 | const context = [_]u32{ 5, 3, 4, 2, 2, 8, 0 }; | 621 | const context = [_]u32{ 5, 3, 4, 2, 2, 8, 0 }; |
| 622 | 622 | ||
| 623 | var queue = CPQlt.init(testing.allocator, context[0..]); | 623 | var queue = CPQlt.init(testing.allocator, context[0..]); |
lib/std/process.zig+2-2| ... | @@ -1818,7 +1818,7 @@ pub const CreateEnvironOptions = struct { | ... | @@ -1818,7 +1818,7 @@ pub const CreateEnvironOptions = struct { |
| 1818 | zig_progress_fd: ?i32 = null, | 1818 | zig_progress_fd: ?i32 = null, |
| 1819 | }; | 1819 | }; |
| 1820 | 1820 | ||
| 1821 | /// Creates a null-deliminated environment variable block in the format | 1821 | /// Creates a null-delimited environment variable block in the format |
| 1822 | /// expected by POSIX, from a hash map plus options. | 1822 | /// expected by POSIX, from a hash map plus options. |
| 1823 | pub fn createEnvironFromMap( | 1823 | pub fn createEnvironFromMap( |
| 1824 | arena: Allocator, | 1824 | arena: Allocator, |
| ... | @@ -1880,7 +1880,7 @@ pub fn createEnvironFromMap( | ... | @@ -1880,7 +1880,7 @@ pub fn createEnvironFromMap( |
| 1880 | return envp_buf; | 1880 | return envp_buf; |
| 1881 | } | 1881 | } |
| 1882 | 1882 | ||
| 1883 | /// Creates a null-deliminated environment variable block in the format | 1883 | /// Creates a null-delimited environment variable block in the format |
| 1884 | /// expected by POSIX, from a hash map plus options. | 1884 | /// expected by POSIX, from a hash map plus options. |
| 1885 | pub fn createEnvironFromExisting( | 1885 | pub fn createEnvironFromExisting( |
| 1886 | arena: Allocator, | 1886 | arena: Allocator, |
lib/std/sort/pdq.zig+1-1| ... | @@ -268,7 +268,7 @@ fn breakPatterns(a: usize, b: usize, context: anytype) void { | ... | @@ -268,7 +268,7 @@ fn breakPatterns(a: usize, b: usize, context: anytype) void { |
| 268 | } | 268 | } |
| 269 | } | 269 | } |
| 270 | 270 | ||
| 271 | /// choses a pivot in `items[a..b]`. | 271 | /// chooses a pivot in `items[a..b]`. |
| 272 | /// swaps likely_sorted when `items[a..b]` seems to be already sorted. | 272 | /// swaps likely_sorted when `items[a..b]` seems to be already sorted. |
| 273 | fn chosePivot(a: usize, b: usize, pivot: *usize, context: anytype) Hint { | 273 | fn chosePivot(a: usize, b: usize, pivot: *usize, context: anytype) Hint { |
| 274 | // minimum length for using the Tukey's ninther method | 274 | // minimum length for using the Tukey's ninther method |
lib/std/tar.zig+2-2| ... | @@ -315,7 +315,7 @@ pub const FileKind = enum { | ... | @@ -315,7 +315,7 @@ pub const FileKind = enum { |
| 315 | file, | 315 | file, |
| 316 | }; | 316 | }; |
| 317 | 317 | ||
| 318 | /// Iteartor over entries in the tar file represented by reader. | 318 | /// Iterator over entries in the tar file represented by reader. |
| 319 | pub fn Iterator(comptime ReaderType: type) type { | 319 | pub fn Iterator(comptime ReaderType: type) type { |
| 320 | return struct { | 320 | return struct { |
| 321 | reader: ReaderType, | 321 | reader: ReaderType, |
| ... | @@ -423,7 +423,7 @@ pub fn Iterator(comptime ReaderType: type) type { | ... | @@ -423,7 +423,7 @@ pub fn Iterator(comptime ReaderType: type) type { |
| 423 | self.padding = blockPadding(size); | 423 | self.padding = blockPadding(size); |
| 424 | 424 | ||
| 425 | switch (kind) { | 425 | switch (kind) { |
| 426 | // File types to retrun upstream | 426 | // File types to return upstream |
| 427 | .directory, .normal, .symbolic_link => { | 427 | .directory, .normal, .symbolic_link => { |
| 428 | file.kind = switch (kind) { | 428 | file.kind = switch (kind) { |
| 429 | .directory => .directory, | 429 | .directory => .directory, |
lib/std/tar/test.zig+1-1| ... | @@ -9,7 +9,7 @@ const Case = struct { | ... | @@ -9,7 +9,7 @@ const Case = struct { |
| 9 | mode: u32 = 0, | 9 | mode: u32 = 0, |
| 10 | link_name: []const u8 = &[0]u8{}, | 10 | link_name: []const u8 = &[0]u8{}, |
| 11 | kind: tar.FileKind = .file, | 11 | kind: tar.FileKind = .file, |
| 12 | truncated: bool = false, // when there is no file body, just header, usefull for huge files | 12 | truncated: bool = false, // when there is no file body, just header, useful for huge files |
| 13 | }; | 13 | }; |
| 14 | 14 | ||
| 15 | data: []const u8, // testdata file content | 15 | data: []const u8, // testdata file content |
lib/std/valgrind/callgrind.zig+1-1| ... | @@ -54,7 +54,7 @@ pub fn startInstrumentation() void { | ... | @@ -54,7 +54,7 @@ pub fn startInstrumentation() void { |
| 54 | 54 | ||
| 55 | /// Stop full callgrind instrumentation if not already switched off. | 55 | /// Stop full callgrind instrumentation if not already switched off. |
| 56 | /// This flushes Valgrinds translation cache, and does no additional | 56 | /// This flushes Valgrinds translation cache, and does no additional |
| 57 | /// instrumentation afterwards, which effectivly will run at the same | 57 | /// instrumentation afterwards, which effectively will run at the same |
| 58 | /// speed as the "none" tool (ie. at minimal slowdown). | 58 | /// speed as the "none" tool (ie. at minimal slowdown). |
| 59 | /// Use this to bypass Callgrind aggregation for uninteresting code parts. | 59 | /// Use this to bypass Callgrind aggregation for uninteresting code parts. |
| 60 | /// To start Callgrind in this mode to ignore the setup phase, use | 60 | /// To start Callgrind in this mode to ignore the setup phase, use |
lib/std/zig/AstGen.zig+5-5| ... | @@ -5085,7 +5085,7 @@ fn structDeclInner( | ... | @@ -5085,7 +5085,7 @@ fn structDeclInner( |
| 5085 | any_default_inits = true; | 5085 | any_default_inits = true; |
| 5086 | 5086 | ||
| 5087 | // The decl_inst is used as here so that we can easily reconstruct a mapping | 5087 | // The decl_inst is used as here so that we can easily reconstruct a mapping |
| 5088 | // between it and the field type when the fields inits are analzyed. | 5088 | // between it and the field type when the fields inits are analyzed. |
| 5089 | const ri: ResultInfo = .{ .rl = if (field_type == .none) .none else .{ .coerced_ty = decl_inst.toRef() } }; | 5089 | const ri: ResultInfo = .{ .rl = if (field_type == .none) .none else .{ .coerced_ty = decl_inst.toRef() } }; |
| 5090 | 5090 | ||
| 5091 | const default_inst = try expr(&block_scope, &namespace.base, ri, member.ast.value_expr); | 5091 | const default_inst = try expr(&block_scope, &namespace.base, ri, member.ast.value_expr); |
| ... | @@ -11559,7 +11559,7 @@ fn identAsString(astgen: *AstGen, ident_token: Ast.TokenIndex) !Zir.NullTerminat | ... | @@ -11559,7 +11559,7 @@ fn identAsString(astgen: *AstGen, ident_token: Ast.TokenIndex) !Zir.NullTerminat |
| 11559 | } | 11559 | } |
| 11560 | 11560 | ||
| 11561 | /// Adds a doc comment block to `string_bytes` by walking backwards from `end_token`. | 11561 | /// Adds a doc comment block to `string_bytes` by walking backwards from `end_token`. |
| 11562 | /// `end_token` must point at the first token after the last doc coment line. | 11562 | /// `end_token` must point at the first token after the last doc comment line. |
| 11563 | /// Returns 0 if no doc comment is present. | 11563 | /// Returns 0 if no doc comment is present. |
| 11564 | fn docCommentAsString(astgen: *AstGen, end_token: Ast.TokenIndex) !Zir.NullTerminatedString { | 11564 | fn docCommentAsString(astgen: *AstGen, end_token: Ast.TokenIndex) !Zir.NullTerminatedString { |
| 11565 | if (end_token == 0) return .empty; | 11565 | if (end_token == 0) return .empty; |
| ... | @@ -11780,7 +11780,7 @@ const Scope = struct { | ... | @@ -11780,7 +11780,7 @@ const Scope = struct { |
| 11780 | inst: Zir.Inst.Ref, | 11780 | inst: Zir.Inst.Ref, |
| 11781 | /// Source location of the corresponding variable declaration. | 11781 | /// Source location of the corresponding variable declaration. |
| 11782 | token_src: Ast.TokenIndex, | 11782 | token_src: Ast.TokenIndex, |
| 11783 | /// Track the first identifer where it is referenced. | 11783 | /// Track the first identifier where it is referenced. |
| 11784 | /// 0 means never referenced. | 11784 | /// 0 means never referenced. |
| 11785 | used: Ast.TokenIndex = 0, | 11785 | used: Ast.TokenIndex = 0, |
| 11786 | /// Track the identifier where it is discarded, like this `_ = foo;`. | 11786 | /// Track the identifier where it is discarded, like this `_ = foo;`. |
| ... | @@ -11803,13 +11803,13 @@ const Scope = struct { | ... | @@ -11803,13 +11803,13 @@ const Scope = struct { |
| 11803 | ptr: Zir.Inst.Ref, | 11803 | ptr: Zir.Inst.Ref, |
| 11804 | /// Source location of the corresponding variable declaration. | 11804 | /// Source location of the corresponding variable declaration. |
| 11805 | token_src: Ast.TokenIndex, | 11805 | token_src: Ast.TokenIndex, |
| 11806 | /// Track the first identifer where it is referenced. | 11806 | /// Track the first identifier where it is referenced. |
| 11807 | /// 0 means never referenced. | 11807 | /// 0 means never referenced. |
| 11808 | used: Ast.TokenIndex = 0, | 11808 | used: Ast.TokenIndex = 0, |
| 11809 | /// Track the identifier where it is discarded, like this `_ = foo;`. | 11809 | /// Track the identifier where it is discarded, like this `_ = foo;`. |
| 11810 | /// 0 means never discarded. | 11810 | /// 0 means never discarded. |
| 11811 | discarded: Ast.TokenIndex = 0, | 11811 | discarded: Ast.TokenIndex = 0, |
| 11812 | /// Whether this value is used as an lvalue after inititialization. | 11812 | /// Whether this value is used as an lvalue after initialization. |
| 11813 | /// If not, we know it can be `const`, so will emit a compile error if it is `var`. | 11813 | /// If not, we know it can be `const`, so will emit a compile error if it is `var`. |
| 11814 | used_as_lvalue: bool = false, | 11814 | used_as_lvalue: bool = false, |
| 11815 | /// String table index. | 11815 | /// String table index. |
lib/std/zig/AstRlAnnotate.zig+2-2| ... | @@ -7,8 +7,8 @@ | ... | @@ -7,8 +7,8 @@ |
| 7 | //! occur. Thus, we want to provide a real result pointer (from an alloc) only | 7 | //! occur. Thus, we want to provide a real result pointer (from an alloc) only |
| 8 | //! when necessary. | 8 | //! when necessary. |
| 9 | //! | 9 | //! |
| 10 | //! To achive this, we need to determine which expressions require a result | 10 | //! To achieve this, we need to determine which expressions require a result |
| 11 | //! pointer. This pass is reponsible for analyzing all syntax forms which may | 11 | //! pointer. This pass is responsible for analyzing all syntax forms which may |
| 12 | //! provide a result location and, if sub-expressions consume this result | 12 | //! provide a result location and, if sub-expressions consume this result |
| 13 | //! pointer non-trivially (e.g. writing through field pointers), marking the | 13 | //! pointer non-trivially (e.g. writing through field pointers), marking the |
| 14 | //! node as requiring a result location. | 14 | //! node as requiring a result location. |
lib/std/zig/WindowsSdk.zig+3-3| ... | @@ -878,7 +878,7 @@ const MsvcLibDir = struct { | ... | @@ -878,7 +878,7 @@ const MsvcLibDir = struct { |
| 878 | error.OutOfMemory => return error.OutOfMemory, | 878 | error.OutOfMemory => return error.OutOfMemory, |
| 879 | else => continue, | 879 | else => continue, |
| 880 | }; | 880 | }; |
| 881 | if (source_directories_value.len > (std.fs.max_path_bytes * 30)) { // note(bratishkaerik): guessing from the fact that on my computer it has 15 pathes and at least some of them are not of max length | 881 | if (source_directories_value.len > (std.fs.max_path_bytes * 30)) { // note(bratishkaerik): guessing from the fact that on my computer it has 15 paths and at least some of them are not of max length |
| 882 | allocator.free(source_directories_value); | 882 | allocator.free(source_directories_value); |
| 883 | continue; | 883 | continue; |
| 884 | } | 884 | } |
| ... | @@ -887,10 +887,10 @@ const MsvcLibDir = struct { | ... | @@ -887,10 +887,10 @@ const MsvcLibDir = struct { |
| 887 | } else return error.PathNotFound; | 887 | } else return error.PathNotFound; |
| 888 | defer allocator.free(source_directories); | 888 | defer allocator.free(source_directories); |
| 889 | 889 | ||
| 890 | var source_directories_splitted = std.mem.splitScalar(u8, source_directories, ';'); | 890 | var source_directories_split = std.mem.splitScalar(u8, source_directories, ';'); |
| 891 | 891 | ||
| 892 | const msvc_dir: []const u8 = msvc_dir: { | 892 | const msvc_dir: []const u8 = msvc_dir: { |
| 893 | const msvc_include_dir_maybe_with_trailing_slash = try allocator.dupe(u8, source_directories_splitted.first()); | 893 | const msvc_include_dir_maybe_with_trailing_slash = try allocator.dupe(u8, source_directories_split.first()); |
| 894 | 894 | ||
| 895 | if (msvc_include_dir_maybe_with_trailing_slash.len > std.fs.max_path_bytes or !std.fs.path.isAbsolute(msvc_include_dir_maybe_with_trailing_slash)) { | 895 | if (msvc_include_dir_maybe_with_trailing_slash.len > std.fs.max_path_bytes or !std.fs.path.isAbsolute(msvc_include_dir_maybe_with_trailing_slash)) { |
| 896 | allocator.free(msvc_include_dir_maybe_with_trailing_slash); | 896 | allocator.free(msvc_include_dir_maybe_with_trailing_slash); |
lib/std/zig/parser_test.zig+1-1| ... | @@ -4540,7 +4540,7 @@ test "zig fmt: decimal float literals with underscore separators" { | ... | @@ -4540,7 +4540,7 @@ test "zig fmt: decimal float literals with underscore separators" { |
| 4540 | ); | 4540 | ); |
| 4541 | } | 4541 | } |
| 4542 | 4542 | ||
| 4543 | test "zig fmt: hexadeciaml float literals with underscore separators" { | 4543 | test "zig fmt: hexadecimal float literals with underscore separators" { |
| 4544 | try testTransform( | 4544 | try testTransform( |
| 4545 | \\pub fn main() void { | 4545 | \\pub fn main() void { |
| 4546 | \\ const a: f64 = (0x10.0p-0+(0x10.0p+0))+0x10_00.00_00p-8+0x00_00.00_10p+16; | 4546 | \\ const a: f64 = (0x10.0p-0+(0x10.0p+0))+0x10_00.00_00p-8+0x00_00.00_10p+16; |
lib/std/zig/system.zig+1-1| ... | @@ -1044,7 +1044,7 @@ fn detectAbiAndDynamicLinker( | ... | @@ -1044,7 +1044,7 @@ fn detectAbiAndDynamicLinker( |
| 1044 | defer if (is_elf_file == false) file.close(); | 1044 | defer if (is_elf_file == false) file.close(); |
| 1045 | 1045 | ||
| 1046 | // Shortest working interpreter path is "#!/i" (4) | 1046 | // Shortest working interpreter path is "#!/i" (4) |
| 1047 | // (interpreter is "/i", assuming all pathes are absolute, like in above comment). | 1047 | // (interpreter is "/i", assuming all paths are absolute, like in above comment). |
| 1048 | // ELF magic number length is also 4. | 1048 | // ELF magic number length is also 4. |
| 1049 | // | 1049 | // |
| 1050 | // If file is shorter than that, it is definitely not ELF file | 1050 | // If file is shorter than that, it is definitely not ELF file |