authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-03-01 20:04:28-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-03-01 20:04:28-07:00
loga20169a610b693794756bbc0139f0955c1294b48
tree5b1e42aba9760bf8b3355cf4014a9d15f59e5a6e
parent7613e51a57d2e2d0ae7d1101d059002f12b96c43

zig fmt the std lib


4 files changed, 22 insertions(+), 22 deletions(-)

lib/std/bit_set.zig+14-13
......@@ -4,10 +4,6 @@
44// The MIT license requires this copyright notice to be included in all copies
55// and substantial portions of the software.
66
7const std = @import("std");
8const assert = std.debug.assert;
9const Allocator = std.mem.Allocator;
10
117//! This file defines several variants of bit sets. A bit set
128//! is a densely stored set of integers with a known maximum,
139//! in which each integer gets a single bit. Bit sets have very
......@@ -40,6 +36,10 @@ const Allocator = std.mem.Allocator;
4036//! A variant of DynamicBitSet which does not store a pointer to its
4137//! allocator, in order to save space.
4238
39const std = @import("std");
40const assert = std.debug.assert;
41const Allocator = std.mem.Allocator;
42
4343/// Returns the optimal static bit set type for the specified number
4444/// of elements. The returned type will perform no allocations,
4545/// can be copied by value, and does not require deinitialization.
......@@ -83,7 +83,7 @@ pub fn IntegerBitSet(comptime size: u16) type {
8383 }
8484
8585 /// Returns the number of bits in this bit set
86 pub inline fn capacity(self: Self) usize {
86 pub fn capacity(self: Self) callconv(.Inline) usize {
8787 return bit_length;
8888 }
8989
......@@ -168,7 +168,7 @@ pub fn IntegerBitSet(comptime size: u16) type {
168168 const mask = self.mask;
169169 if (mask == 0) return null;
170170 const index = @ctz(MaskInt, mask);
171 self.mask = mask & (mask-1);
171 self.mask = mask & (mask - 1);
172172 return index;
173173 }
174174
......@@ -306,7 +306,7 @@ pub fn ArrayBitSet(comptime MaskIntType: type, comptime size: usize) type {
306306 }
307307
308308 /// Returns the number of bits in this bit set
309 pub inline fn capacity(self: Self) usize {
309 pub fn capacity(self: Self) callconv(.Inline) usize {
310310 return bit_length;
311311 }
312312
......@@ -566,7 +566,7 @@ pub const DynamicBitSetUnmanaged = struct {
566566 }
567567
568568 /// Returns the number of bits in this bit set
569 pub inline fn capacity(self: Self) usize {
569 pub fn capacity(self: Self) callconv(.Inline) usize {
570570 return self.bit_length;
571571 }
572572
......@@ -691,7 +691,7 @@ pub const DynamicBitSetUnmanaged = struct {
691691 offset += @bitSizeOf(MaskInt);
692692 } else return null;
693693 const index = @ctz(MaskInt, mask[0]);
694 mask[0] &= (mask[0]-1);
694 mask[0] &= (mask[0] - 1);
695695 return offset + index;
696696 }
697697
......@@ -777,7 +777,7 @@ pub const DynamicBitSet = struct {
777777 }
778778
779779 /// Returns the number of bits in this bit set
780 pub inline fn capacity(self: Self) usize {
780 pub fn capacity(self: Self) callconv(.Inline) usize {
781781 return self.unmanaged.capacity();
782782 }
783783
......@@ -955,7 +955,7 @@ fn BitSetIterator(comptime MaskInt: type, comptime options: IteratorOptions) typ
955955 // isn't a next word. If the next word is the
956956 // last word, mask off the padding bits so we
957957 // don't visit them.
958 inline fn nextWord(self: *Self, comptime is_first_word: bool) void {
958 fn nextWord(self: *Self, comptime is_first_word: bool) callconv(.Inline) void {
959959 var word = switch (direction) {
960960 .forward => self.words_remain[0],
961961 .reverse => self.words_remain[self.words_remain.len - 1],
......@@ -1114,8 +1114,9 @@ fn testBitSet(a: anytype, b: anytype, len: usize) void {
11141114 }
11151115
11161116 const test_bits = [_]usize{
1117 0, 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 22, 31, 32, 63, 64,
1118 66, 95, 127, 160, 192, 1000 };
1117 0, 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 22, 31, 32, 63, 64,
1118 66, 95, 127, 160, 192, 1000,
1119 };
11191120 for (test_bits) |i| {
11201121 if (i < a.capacity()) {
11211122 a.set(i);
lib/std/fs/get_app_data_dir.zig+1-1
......@@ -60,7 +60,7 @@ pub fn getAppDataDir(allocator: *mem.Allocator, appname: []const u8) GetAppDataD
6060 var dir_path_ptr: [*:0]u8 = undefined;
6161 // TODO look into directory_which
6262 const be_user_settings = 0xbbe;
63 const rc = os.system.find_directory(be_user_settings, -1, true, dir_path_ptr, 1) ;
63 const rc = os.system.find_directory(be_user_settings, -1, true, dir_path_ptr, 1);
6464 const settings_dir = try allocator.dupeZ(u8, mem.spanZ(dir_path_ptr));
6565 defer allocator.free(settings_dir);
6666 switch (rc) {
lib/std/math.zig+1-1
......@@ -1334,7 +1334,7 @@ test "math.comptime" {
13341334/// Returns a mask of all ones if value is true,
13351335/// and a mask of all zeroes if value is false.
13361336/// Compiles to one instruction for register sized integers.
1337pub inline fn boolMask(comptime MaskInt: type, value: bool) MaskInt {
1337pub fn boolMask(comptime MaskInt: type, value: bool) callconv(.Inline) MaskInt {
13381338 if (@typeInfo(MaskInt) != .Int)
13391339 @compileError("boolMask requires an integer mask type.");
13401340
lib/std/os/bits/haiku.zig+6-7
......@@ -180,8 +180,8 @@ pub const dirent = extern struct {
180180};
181181
182182pub const image_info = extern struct {
183 id: u32, //image_id
184 type: u32, // image_type
183 id: u32,
184 type: u32,
185185 sequence: i32,
186186 init_order: i32,
187187 init_routine: *c_void,
......@@ -806,17 +806,16 @@ pub const Sigaction = extern struct {
806806
807807pub const _SIG_WORDS = 4;
808808pub const _SIG_MAXSIG = 128;
809
810pub inline fn _SIG_IDX(sig: usize) usize {
809pub fn _SIG_IDX(sig: usize) callconv(.Inline) usize {
811810 return sig - 1;
812811}
813pub inline fn _SIG_WORD(sig: usize) usize {
812pub fn _SIG_WORD(sig: usize) callconv(.Inline) usize {
814813 return_SIG_IDX(sig) >> 5;
815814}
816pub inline fn _SIG_BIT(sig: usize) usize {
815pub fn _SIG_BIT(sig: usize) callconv(.Inline) usize {
817816 return 1 << (_SIG_IDX(sig) & 31);
818817}
819pub inline fn _SIG_VALID(sig: usize) usize {
818pub fn _SIG_VALID(sig: usize) callconv(.Inline) usize {
820819 return sig <= _SIG_MAXSIG and sig > 0;
821820}
822821