authorgravatar for me@tadeo.caTadeo Kondrak <me@tadeo.ca> 2021-01-11 08:03:09-07:00
committergravatar for me@tadeo.caTadeo Kondrak <me@tadeo.ca> 2021-02-10 20:06:12-07:00
log5dfe0e7e8fabd3cfc3fdf5c7099791da98899903
tree9232489bf17f8ac7dec688277dcfcc1792849d3e
parent9c797fe3ac3a377caa01bdbd74b984d11b53398e
signature Commit is signed but in an unrecognized format.

Convert inline fn to callconv(.Inline) everywhere


36 files changed, 199 insertions(+), 199 deletions(-)

doc/langref.html.in+2-2
...@@ -4240,9 +4240,9 @@ fn _start() callconv(.Naked) noreturn {...@@ -4240,9 +4240,9 @@ fn _start() callconv(.Naked) noreturn {
4240 abort();4240 abort();
4241}4241}
42424242
4243// The inline specifier forces a function to be inlined at all call sites.4243// The inline calling convention forces a function to be inlined at all call sites.
4244// If the function cannot be inlined, it is a compile-time error.4244// If the function cannot be inlined, it is a compile-time error.
4245inline fn shiftLeftOne(a: u32) u32 {4245fn shiftLeftOne(a: u32) callconv(.Inline) u32 {
4246 return a << 1;4246 return a << 1;
4247}4247}
42484248
lib/std/c/builtins.zig+49-49
...@@ -6,70 +6,70 @@...@@ -6,70 +6,70 @@
66
7const std = @import("std");7const std = @import("std");
88
9pub inline fn __builtin_bswap16(val: u16) callconv(.C) u16 { return @byteSwap(u16, val); }9pub fn __builtin_bswap16(val: u16) callconv(.Inline) u16 { return @byteSwap(u16, val); }
10pub inline fn __builtin_bswap32(val: u32) callconv(.C) u32 { return @byteSwap(u32, val); }10pub fn __builtin_bswap32(val: u32) callconv(.Inline) u32 { return @byteSwap(u32, val); }
11pub inline fn __builtin_bswap64(val: u64) callconv(.C) u64 { return @byteSwap(u64, val); }11pub fn __builtin_bswap64(val: u64) callconv(.Inline) u64 { return @byteSwap(u64, val); }
1212
13pub inline fn __builtin_signbit(val: f64) callconv(.C) c_int { return @boolToInt(std.math.signbit(val)); }13pub fn __builtin_signbit(val: f64) callconv(.Inline) c_int { return @boolToInt(std.math.signbit(val)); }
14pub inline fn __builtin_signbitf(val: f32) callconv(.C) c_int { return @boolToInt(std.math.signbit(val)); }14pub fn __builtin_signbitf(val: f32) callconv(.Inline) c_int { return @boolToInt(std.math.signbit(val)); }
1515
16pub inline fn __builtin_popcount(val: c_uint) callconv(.C) c_int {16pub fn __builtin_popcount(val: c_uint) callconv(.Inline) c_int {
17 // popcount of a c_uint will never exceed the capacity of a c_int17 // popcount of a c_uint will never exceed the capacity of a c_int
18 @setRuntimeSafety(false);18 @setRuntimeSafety(false);
19 return @bitCast(c_int, @as(c_uint, @popCount(c_uint, val)));19 return @bitCast(c_int, @as(c_uint, @popCount(c_uint, val)));
20}20}
21pub inline fn __builtin_ctz(val: c_uint) callconv(.C) c_int {21pub fn __builtin_ctz(val: c_uint) callconv(.Inline) c_int {
22 // Returns the number of trailing 0-bits in val, starting at the least significant bit position.22 // Returns the number of trailing 0-bits in val, starting at the least significant bit position.
23 // In C if `val` is 0, the result is undefined; in zig it's the number of bits in a c_uint23 // In C if `val` is 0, the result is undefined; in zig it's the number of bits in a c_uint
24 @setRuntimeSafety(false);24 @setRuntimeSafety(false);
25 return @bitCast(c_int, @as(c_uint, @ctz(c_uint, val)));25 return @bitCast(c_int, @as(c_uint, @ctz(c_uint, val)));
26}26}
27pub inline fn __builtin_clz(val: c_uint) callconv(.C) c_int {27pub fn __builtin_clz(val: c_uint) callconv(.Inline) c_int {
28 // Returns the number of leading 0-bits in x, starting at the most significant bit position.28 // Returns the number of leading 0-bits in x, starting at the most significant bit position.
29 // In C if `val` is 0, the result is undefined; in zig it's the number of bits in a c_uint29 // In C if `val` is 0, the result is undefined; in zig it's the number of bits in a c_uint
30 @setRuntimeSafety(false);30 @setRuntimeSafety(false);
31 return @bitCast(c_int, @as(c_uint, @clz(c_uint, val)));31 return @bitCast(c_int, @as(c_uint, @clz(c_uint, val)));
32}32}
3333
34pub inline fn __builtin_sqrt(val: f64) callconv(.C) f64 { return @sqrt(val); }34pub fn __builtin_sqrt(val: f64) callconv(.Inline) f64 { return @sqrt(val); }
35pub inline fn __builtin_sqrtf(val: f32) callconv(.C) f32 { return @sqrt(val); }35pub fn __builtin_sqrtf(val: f32) callconv(.Inline) f32 { return @sqrt(val); }
3636
37pub inline fn __builtin_sin(val: f64) callconv(.C) f64 { return @sin(val); }37pub fn __builtin_sin(val: f64) callconv(.Inline) f64 { return @sin(val); }
38pub inline fn __builtin_sinf(val: f32) callconv(.C) f32 { return @sin(val); }38pub fn __builtin_sinf(val: f32) callconv(.Inline) f32 { return @sin(val); }
39pub inline fn __builtin_cos(val: f64) callconv(.C) f64 { return @cos(val); }39pub fn __builtin_cos(val: f64) callconv(.Inline) f64 { return @cos(val); }
40pub inline fn __builtin_cosf(val: f32) callconv(.C) f32 { return @cos(val); }40pub fn __builtin_cosf(val: f32) callconv(.Inline) f32 { return @cos(val); }
4141
42pub inline fn __builtin_exp(val: f64) callconv(.C) f64 { return @exp(val); }42pub fn __builtin_exp(val: f64) callconv(.Inline) f64 { return @exp(val); }
43pub inline fn __builtin_expf(val: f32) callconv(.C) f32 { return @exp(val); }43pub fn __builtin_expf(val: f32) callconv(.Inline) f32 { return @exp(val); }
44pub inline fn __builtin_exp2(val: f64) callconv(.C) f64 { return @exp2(val); }44pub fn __builtin_exp2(val: f64) callconv(.Inline) f64 { return @exp2(val); }
45pub inline fn __builtin_exp2f(val: f32) callconv(.C) f32 { return @exp2(val); }45pub fn __builtin_exp2f(val: f32) callconv(.Inline) f32 { return @exp2(val); }
46pub inline fn __builtin_log(val: f64) callconv(.C) f64 { return @log(val); }46pub fn __builtin_log(val: f64) callconv(.Inline) f64 { return @log(val); }
47pub inline fn __builtin_logf(val: f32) callconv(.C) f32 { return @log(val); }47pub fn __builtin_logf(val: f32) callconv(.Inline) f32 { return @log(val); }
48pub inline fn __builtin_log2(val: f64) callconv(.C) f64 { return @log2(val); }48pub fn __builtin_log2(val: f64) callconv(.Inline) f64 { return @log2(val); }
49pub inline fn __builtin_log2f(val: f32) callconv(.C) f32 { return @log2(val); }49pub fn __builtin_log2f(val: f32) callconv(.Inline) f32 { return @log2(val); }
50pub inline fn __builtin_log10(val: f64) callconv(.C) f64 { return @log10(val); }50pub fn __builtin_log10(val: f64) callconv(.Inline) f64 { return @log10(val); }
51pub inline fn __builtin_log10f(val: f32) callconv(.C) f32 { return @log10(val); }51pub fn __builtin_log10f(val: f32) callconv(.Inline) f32 { return @log10(val); }
5252
53// Standard C Library bug: The absolute value of the most negative integer remains negative.53// Standard C Library bug: The absolute value of the most negative integer remains negative.
54pub inline fn __builtin_abs(val: c_int) callconv(.C) c_int { return std.math.absInt(val) catch std.math.minInt(c_int); }54pub fn __builtin_abs(val: c_int) callconv(.Inline) c_int { return std.math.absInt(val) catch std.math.minInt(c_int); }
55pub inline fn __builtin_fabs(val: f64) callconv(.C) f64 { return @fabs(val); }55pub fn __builtin_fabs(val: f64) callconv(.Inline) f64 { return @fabs(val); }
56pub inline fn __builtin_fabsf(val: f32) callconv(.C) f32 { return @fabs(val); }56pub fn __builtin_fabsf(val: f32) callconv(.Inline) f32 { return @fabs(val); }
5757
58pub inline fn __builtin_floor(val: f64) callconv(.C) f64 { return @floor(val); }58pub fn __builtin_floor(val: f64) callconv(.Inline) f64 { return @floor(val); }
59pub inline fn __builtin_floorf(val: f32) callconv(.C) f32 { return @floor(val); }59pub fn __builtin_floorf(val: f32) callconv(.Inline) f32 { return @floor(val); }
60pub inline fn __builtin_ceil(val: f64) callconv(.C) f64 { return @ceil(val); }60pub fn __builtin_ceil(val: f64) callconv(.Inline) f64 { return @ceil(val); }
61pub inline fn __builtin_ceilf(val: f32) callconv(.C) f32 { return @ceil(val); }61pub fn __builtin_ceilf(val: f32) callconv(.Inline) f32 { return @ceil(val); }
62pub inline fn __builtin_trunc(val: f64) callconv(.C) f64 { return @trunc(val); }62pub fn __builtin_trunc(val: f64) callconv(.Inline) f64 { return @trunc(val); }
63pub inline fn __builtin_truncf(val: f32) callconv(.C) f32 { return @trunc(val); }63pub fn __builtin_truncf(val: f32) callconv(.Inline) f32 { return @trunc(val); }
64pub inline fn __builtin_round(val: f64) callconv(.C) f64 { return @round(val); }64pub fn __builtin_round(val: f64) callconv(.Inline) f64 { return @round(val); }
65pub inline fn __builtin_roundf(val: f32) callconv(.C) f32 { return @round(val); }65pub fn __builtin_roundf(val: f32) callconv(.Inline) f32 { return @round(val); }
6666
67pub inline fn __builtin_strlen(s: [*c]const u8) callconv(.C) usize { return std.mem.lenZ(s); }67pub fn __builtin_strlen(s: [*c]const u8) callconv(.Inline) usize { return std.mem.lenZ(s); }
68pub inline fn __builtin_strcmp(s1: [*c]const u8, s2: [*c]const u8) callconv(.C) c_int {68pub fn __builtin_strcmp(s1: [*c]const u8, s2: [*c]const u8) callconv(.Inline) c_int {
69 return @as(c_int, std.cstr.cmp(s1, s2));69 return @as(c_int, std.cstr.cmp(s1, s2));
70}70}
7171
72pub inline fn __builtin_object_size(ptr: ?*const c_void, ty: c_int) callconv(.C) usize {72pub fn __builtin_object_size(ptr: ?*const c_void, ty: c_int) callconv(.Inline) usize {
73 // clang semantics match gcc's: https://gcc.gnu.org/onlinedocs/gcc/Object-Size-Checking.html73 // clang semantics match gcc's: https://gcc.gnu.org/onlinedocs/gcc/Object-Size-Checking.html
74 // If it is not possible to determine which objects ptr points to at compile time,74 // If it is not possible to determine which objects ptr points to at compile time,
75 // __builtin_object_size should return (size_t) -1 for type 0 or 1 and (size_t) 075 // __builtin_object_size should return (size_t) -1 for type 0 or 1 and (size_t) 0
...@@ -79,37 +79,37 @@ pub inline fn __builtin_object_size(ptr: ?*const c_void, ty: c_int) callconv(.C)...@@ -79,37 +79,37 @@ pub inline fn __builtin_object_size(ptr: ?*const c_void, ty: c_int) callconv(.C)
79 unreachable;79 unreachable;
80}80}
8181
82pub inline fn __builtin___memset_chk(82pub fn __builtin___memset_chk(
83 dst: ?*c_void,83 dst: ?*c_void,
84 val: c_int,84 val: c_int,
85 len: usize,85 len: usize,
86 remaining: usize,86 remaining: usize,
87) callconv(.C) ?*c_void {87) callconv(.Inline) ?*c_void {
88 if (len > remaining) @panic("std.c.builtins.memset_chk called with len > remaining");88 if (len > remaining) @panic("std.c.builtins.memset_chk called with len > remaining");
89 return __builtin_memset(dst, val, len);89 return __builtin_memset(dst, val, len);
90}90}
9191
92pub inline fn __builtin_memset(dst: ?*c_void, val: c_int, len: usize) callconv(.C) ?*c_void {92pub fn __builtin_memset(dst: ?*c_void, val: c_int, len: usize) callconv(.Inline) ?*c_void {
93 const dst_cast = @ptrCast([*c]u8, dst);93 const dst_cast = @ptrCast([*c]u8, dst);
94 @memset(dst_cast, @bitCast(u8, @truncate(i8, val)), len);94 @memset(dst_cast, @bitCast(u8, @truncate(i8, val)), len);
95 return dst;95 return dst;
96}96}
9797
98pub inline fn __builtin___memcpy_chk(98pub fn __builtin___memcpy_chk(
99 noalias dst: ?*c_void,99 noalias dst: ?*c_void,
100 noalias src: ?*const c_void,100 noalias src: ?*const c_void,
101 len: usize,101 len: usize,
102 remaining: usize,102 remaining: usize,
103) callconv(.C) ?*c_void {103) callconv(.Inline) ?*c_void {
104 if (len > remaining) @panic("std.c.builtins.memcpy_chk called with len > remaining");104 if (len > remaining) @panic("std.c.builtins.memcpy_chk called with len > remaining");
105 return __builtin_memcpy(dst, src, len);105 return __builtin_memcpy(dst, src, len);
106}106}
107107
108pub inline fn __builtin_memcpy(108pub fn __builtin_memcpy(
109 noalias dst: ?*c_void,109 noalias dst: ?*c_void,
110 noalias src: ?*const c_void,110 noalias src: ?*const c_void,
111 len: usize,111 len: usize,
112) callconv(.C) ?*c_void {112) callconv(.Inline) ?*c_void {
113 const dst_cast = @ptrCast([*c]u8, dst);113 const dst_cast = @ptrCast([*c]u8, dst);
114 const src_cast = @ptrCast([*c]const u8, src);114 const src_cast = @ptrCast([*c]const u8, src);
115115
lib/std/compress/deflate.zig+1-1
...@@ -209,7 +209,7 @@ pub fn InflateStream(comptime ReaderType: type) type {...@@ -209,7 +209,7 @@ pub fn InflateStream(comptime ReaderType: type) type {
209209
210 // Insert a single byte into the window.210 // Insert a single byte into the window.
211 // Assumes there's enough space.211 // Assumes there's enough space.
212 inline fn appendUnsafe(self: *WSelf, value: u8) void {212 fn appendUnsafe(self: *WSelf, value: u8) callconv(.Inline) void {
213 self.buf[self.wi] = value;213 self.buf[self.wi] = value;
214 self.wi = (self.wi + 1) & (self.buf.len - 1);214 self.wi = (self.wi + 1) & (self.buf.len - 1);
215 self.el += 1;215 self.el += 1;
lib/std/crypto/25519/curve25519.zig+2-2
...@@ -15,12 +15,12 @@ pub const Curve25519 = struct {...@@ -15,12 +15,12 @@ pub const Curve25519 = struct {
15 x: Fe,15 x: Fe,
1616
17 /// Decode a Curve25519 point from its compressed (X) coordinates.17 /// Decode a Curve25519 point from its compressed (X) coordinates.
18 pub inline fn fromBytes(s: [32]u8) Curve25519 {18 pub fn fromBytes(s: [32]u8) callconv(.Inline) Curve25519 {
19 return .{ .x = Fe.fromBytes(s) };19 return .{ .x = Fe.fromBytes(s) };
20 }20 }
2121
22 /// Encode a Curve25519 point.22 /// Encode a Curve25519 point.
23 pub inline fn toBytes(p: Curve25519) [32]u8 {23 pub fn toBytes(p: Curve25519) callconv(.Inline) [32]u8 {
24 return p.x.toBytes();24 return p.x.toBytes();
25 }25 }
2626
lib/std/crypto/25519/edwards25519.zig+3-3
...@@ -92,7 +92,7 @@ pub const Edwards25519 = struct {...@@ -92,7 +92,7 @@ pub const Edwards25519 = struct {
92 }92 }
9393
94 /// Flip the sign of the X coordinate.94 /// Flip the sign of the X coordinate.
95 pub inline fn neg(p: Edwards25519) Edwards25519 {95 pub fn neg(p: Edwards25519) callconv(.Inline) Edwards25519 {
96 return .{ .x = p.x.neg(), .y = p.y, .z = p.z, .t = p.t.neg() };96 return .{ .x = p.x.neg(), .y = p.y, .z = p.z, .t = p.t.neg() };
97 }97 }
9898
...@@ -137,14 +137,14 @@ pub const Edwards25519 = struct {...@@ -137,14 +137,14 @@ pub const Edwards25519 = struct {
137 return p.add(q.neg());137 return p.add(q.neg());
138 }138 }
139139
140 inline fn cMov(p: *Edwards25519, a: Edwards25519, c: u64) void {140 fn cMov(p: *Edwards25519, a: Edwards25519, c: u64) callconv(.Inline) void {
141 p.x.cMov(a.x, c);141 p.x.cMov(a.x, c);
142 p.y.cMov(a.y, c);142 p.y.cMov(a.y, c);
143 p.z.cMov(a.z, c);143 p.z.cMov(a.z, c);
144 p.t.cMov(a.t, c);144 p.t.cMov(a.t, c);
145 }145 }
146146
147 inline fn pcSelect(comptime n: usize, pc: [n]Edwards25519, b: u8) Edwards25519 {147 fn pcSelect(comptime n: usize, pc: [n]Edwards25519, b: u8) callconv(.Inline) Edwards25519 {
148 var t = Edwards25519.identityElement;148 var t = Edwards25519.identityElement;
149 comptime var i: u8 = 1;149 comptime var i: u8 = 1;
150 inline while (i < pc.len) : (i += 1) {150 inline while (i < pc.len) : (i += 1) {
lib/std/crypto/25519/field.zig+14-14
...@@ -52,7 +52,7 @@ pub const Fe = struct {...@@ -52,7 +52,7 @@ pub const Fe = struct {
52 pub const edwards25519sqrtam2 = Fe{ .limbs = .{ 1693982333959686, 608509411481997, 2235573344831311, 947681270984193, 266558006233600 } };52 pub const edwards25519sqrtam2 = Fe{ .limbs = .{ 1693982333959686, 608509411481997, 2235573344831311, 947681270984193, 266558006233600 } };
5353
54 /// Return true if the field element is zero54 /// Return true if the field element is zero
55 pub inline fn isZero(fe: Fe) bool {55 pub fn isZero(fe: Fe) callconv(.Inline) bool {
56 var reduced = fe;56 var reduced = fe;
57 reduced.reduce();57 reduced.reduce();
58 const limbs = reduced.limbs;58 const limbs = reduced.limbs;
...@@ -60,7 +60,7 @@ pub const Fe = struct {...@@ -60,7 +60,7 @@ pub const Fe = struct {
60 }60 }
6161
62 /// Return true if both field elements are equivalent62 /// Return true if both field elements are equivalent
63 pub inline fn equivalent(a: Fe, b: Fe) bool {63 pub fn equivalent(a: Fe, b: Fe) callconv(.Inline) bool {
64 return a.sub(b).isZero();64 return a.sub(b).isZero();
65 }65 }
6666
...@@ -164,7 +164,7 @@ pub const Fe = struct {...@@ -164,7 +164,7 @@ pub const Fe = struct {
164 }164 }
165165
166 /// Add a field element166 /// Add a field element
167 pub inline fn add(a: Fe, b: Fe) Fe {167 pub fn add(a: Fe, b: Fe) callconv(.Inline) Fe {
168 var fe: Fe = undefined;168 var fe: Fe = undefined;
169 comptime var i = 0;169 comptime var i = 0;
170 inline while (i < 5) : (i += 1) {170 inline while (i < 5) : (i += 1) {
...@@ -174,7 +174,7 @@ pub const Fe = struct {...@@ -174,7 +174,7 @@ pub const Fe = struct {
174 }174 }
175175
176 /// Substract a field elememnt176 /// Substract a field elememnt
177 pub inline fn sub(a: Fe, b: Fe) Fe {177 pub fn sub(a: Fe, b: Fe) callconv(.Inline) Fe {
178 var fe = b;178 var fe = b;
179 comptime var i = 0;179 comptime var i = 0;
180 inline while (i < 4) : (i += 1) {180 inline while (i < 4) : (i += 1) {
...@@ -193,17 +193,17 @@ pub const Fe = struct {...@@ -193,17 +193,17 @@ pub const Fe = struct {
193 }193 }
194194
195 /// Negate a field element195 /// Negate a field element
196 pub inline fn neg(a: Fe) Fe {196 pub fn neg(a: Fe) callconv(.Inline) Fe {
197 return zero.sub(a);197 return zero.sub(a);
198 }198 }
199199
200 /// Return true if a field element is negative200 /// Return true if a field element is negative
201 pub inline fn isNegative(a: Fe) bool {201 pub fn isNegative(a: Fe) callconv(.Inline) bool {
202 return (a.toBytes()[0] & 1) != 0;202 return (a.toBytes()[0] & 1) != 0;
203 }203 }
204204
205 /// Conditonally replace a field element with `a` if `c` is positive205 /// Conditonally replace a field element with `a` if `c` is positive
206 pub inline fn cMov(fe: *Fe, a: Fe, c: u64) void {206 pub fn cMov(fe: *Fe, a: Fe, c: u64) callconv(.Inline) void {
207 const mask: u64 = 0 -% c;207 const mask: u64 = 0 -% c;
208 var x = fe.*;208 var x = fe.*;
209 comptime var i = 0;209 comptime var i = 0;
...@@ -244,7 +244,7 @@ pub const Fe = struct {...@@ -244,7 +244,7 @@ pub const Fe = struct {
244 }244 }
245 }245 }
246246
247 inline fn _carry128(r: *[5]u128) Fe {247 fn _carry128(r: *[5]u128) callconv(.Inline) Fe {
248 var rs: [5]u64 = undefined;248 var rs: [5]u64 = undefined;
249 comptime var i = 0;249 comptime var i = 0;
250 inline while (i < 4) : (i += 1) {250 inline while (i < 4) : (i += 1) {
...@@ -265,7 +265,7 @@ pub const Fe = struct {...@@ -265,7 +265,7 @@ pub const Fe = struct {
265 }265 }
266266
267 /// Multiply two field elements267 /// Multiply two field elements
268 pub inline fn mul(a: Fe, b: Fe) Fe {268 pub fn mul(a: Fe, b: Fe) callconv(.Inline) Fe {
269 var ax: [5]u128 = undefined;269 var ax: [5]u128 = undefined;
270 var bx: [5]u128 = undefined;270 var bx: [5]u128 = undefined;
271 var a19: [5]u128 = undefined;271 var a19: [5]u128 = undefined;
...@@ -288,7 +288,7 @@ pub const Fe = struct {...@@ -288,7 +288,7 @@ pub const Fe = struct {
288 return _carry128(&r);288 return _carry128(&r);
289 }289 }
290290
291 inline fn _sq(a: Fe, double: comptime bool) Fe {291 fn _sq(a: Fe, double: comptime bool) callconv(.Inline) Fe {
292 var ax: [5]u128 = undefined;292 var ax: [5]u128 = undefined;
293 var r: [5]u128 = undefined;293 var r: [5]u128 = undefined;
294 comptime var i = 0;294 comptime var i = 0;
...@@ -317,17 +317,17 @@ pub const Fe = struct {...@@ -317,17 +317,17 @@ pub const Fe = struct {
317 }317 }
318318
319 /// Square a field element319 /// Square a field element
320 pub inline fn sq(a: Fe) Fe {320 pub fn sq(a: Fe) callconv(.Inline) Fe {
321 return _sq(a, false);321 return _sq(a, false);
322 }322 }
323323
324 /// Square and double a field element324 /// Square and double a field element
325 pub inline fn sq2(a: Fe) Fe {325 pub fn sq2(a: Fe) callconv(.Inline) Fe {
326 return _sq(a, true);326 return _sq(a, true);
327 }327 }
328328
329 /// Multiply a field element with a small (32-bit) integer329 /// Multiply a field element with a small (32-bit) integer
330 pub inline fn mul32(a: Fe, comptime n: u32) Fe {330 pub fn mul32(a: Fe, comptime n: u32) callconv(.Inline) Fe {
331 const sn = @intCast(u128, n);331 const sn = @intCast(u128, n);
332 var fe: Fe = undefined;332 var fe: Fe = undefined;
333 var x: u128 = 0;333 var x: u128 = 0;
...@@ -342,7 +342,7 @@ pub const Fe = struct {...@@ -342,7 +342,7 @@ pub const Fe = struct {
342 }342 }
343343
344 /// Square a field element `n` times344 /// Square a field element `n` times
345 inline fn sqn(a: Fe, comptime n: comptime_int) Fe {345 fn sqn(a: Fe, comptime n: comptime_int) callconv(.Inline) Fe {
346 var i: usize = 0;346 var i: usize = 0;
347 var fe = a;347 var fe = a;
348 while (i < n) : (i += 1) {348 while (i < n) : (i += 1) {
lib/std/crypto/25519/ristretto255.zig+4-4
...@@ -42,7 +42,7 @@ pub const Ristretto255 = struct {...@@ -42,7 +42,7 @@ pub const Ristretto255 = struct {
42 }42 }
4343
44 /// Reject the neutral element.44 /// Reject the neutral element.
45 pub inline fn rejectIdentity(p: Ristretto255) !void {45 pub fn rejectIdentity(p: Ristretto255) callconv(.Inline) !void {
46 return p.p.rejectIdentity();46 return p.p.rejectIdentity();
47 }47 }
4848
...@@ -141,19 +141,19 @@ pub const Ristretto255 = struct {...@@ -141,19 +141,19 @@ pub const Ristretto255 = struct {
141 }141 }
142142
143 /// Double a Ristretto255 element.143 /// Double a Ristretto255 element.
144 pub inline fn dbl(p: Ristretto255) Ristretto255 {144 pub fn dbl(p: Ristretto255) callconv(.Inline) Ristretto255 {
145 return .{ .p = p.p.dbl() };145 return .{ .p = p.p.dbl() };
146 }146 }
147147
148 /// Add two Ristretto255 elements.148 /// Add two Ristretto255 elements.
149 pub inline fn add(p: Ristretto255, q: Ristretto255) Ristretto255 {149 pub fn add(p: Ristretto255, q: Ristretto255) callconv(.Inline) Ristretto255 {
150 return .{ .p = p.p.add(q.p) };150 return .{ .p = p.p.add(q.p) };
151 }151 }
152152
153 /// Multiply a Ristretto255 element with a scalar.153 /// Multiply a Ristretto255 element with a scalar.
154 /// Return error.WeakPublicKey if the resulting element is154 /// Return error.WeakPublicKey if the resulting element is
155 /// the identity element.155 /// the identity element.
156 pub inline fn mul(p: Ristretto255, s: [encoded_length]u8) !Ristretto255 {156 pub fn mul(p: Ristretto255, s: [encoded_length]u8) callconv(.Inline) !Ristretto255 {
157 return Ristretto255{ .p = try p.p.mul(s) };157 return Ristretto255{ .p = try p.p.mul(s) };
158 }158 }
159159
lib/std/crypto/25519/scalar.zig+1-1
...@@ -46,7 +46,7 @@ pub fn reduce64(s: [64]u8) [32]u8 {...@@ -46,7 +46,7 @@ pub fn reduce64(s: [64]u8) [32]u8 {
4646
47/// Perform the X25519 "clamping" operation.47/// Perform the X25519 "clamping" operation.
48/// The scalar is then guaranteed to be a multiple of the cofactor.48/// The scalar is then guaranteed to be a multiple of the cofactor.
49pub inline fn clamp(s: *[32]u8) void {49pub fn clamp(s: *[32]u8) callconv(.Inline) void {
50 s[0] &= 248;50 s[0] &= 248;
51 s[31] = (s[31] & 127) | 64;51 s[31] = (s[31] & 127) | 64;
52}52}
lib/std/crypto/aegis.zig+2-2
...@@ -35,7 +35,7 @@ const State128L = struct {...@@ -35,7 +35,7 @@ const State128L = struct {
35 return state;35 return state;
36 }36 }
3737
38 inline fn update(state: *State128L, d1: AesBlock, d2: AesBlock) void {38 fn update(state: *State128L, d1: AesBlock, d2: AesBlock) callconv(.Inline) void {
39 const blocks = &state.blocks;39 const blocks = &state.blocks;
40 const tmp = blocks[7];40 const tmp = blocks[7];
41 comptime var i: usize = 7;41 comptime var i: usize = 7;
...@@ -207,7 +207,7 @@ const State256 = struct {...@@ -207,7 +207,7 @@ const State256 = struct {
207 return state;207 return state;
208 }208 }
209209
210 inline fn update(state: *State256, d: AesBlock) void {210 fn update(state: *State256, d: AesBlock) callconv(.Inline) void {
211 const blocks = &state.blocks;211 const blocks = &state.blocks;
212 const tmp = blocks[5].encrypt(blocks[0]);212 const tmp = blocks[5].encrypt(blocks[0]);
213 comptime var i: usize = 5;213 comptime var i: usize = 5;
lib/std/crypto/aes/aesni.zig+16-16
...@@ -19,24 +19,24 @@ pub const Block = struct {...@@ -19,24 +19,24 @@ pub const Block = struct {
19 repr: BlockVec,19 repr: BlockVec,
2020
21 /// Convert a byte sequence into an internal representation.21 /// Convert a byte sequence into an internal representation.
22 pub inline fn fromBytes(bytes: *const [16]u8) Block {22 pub fn fromBytes(bytes: *const [16]u8) callconv(.Inline) Block {
23 const repr = mem.bytesToValue(BlockVec, bytes);23 const repr = mem.bytesToValue(BlockVec, bytes);
24 return Block{ .repr = repr };24 return Block{ .repr = repr };
25 }25 }
2626
27 /// Convert the internal representation of a block into a byte sequence.27 /// Convert the internal representation of a block into a byte sequence.
28 pub inline fn toBytes(block: Block) [16]u8 {28 pub fn toBytes(block: Block) callconv(.Inline) [16]u8 {
29 return mem.toBytes(block.repr);29 return mem.toBytes(block.repr);
30 }30 }
3131
32 /// XOR the block with a byte sequence.32 /// XOR the block with a byte sequence.
33 pub inline fn xorBytes(block: Block, bytes: *const [16]u8) [16]u8 {33 pub fn xorBytes(block: Block, bytes: *const [16]u8) callconv(.Inline) [16]u8 {
34 const x = block.repr ^ fromBytes(bytes).repr;34 const x = block.repr ^ fromBytes(bytes).repr;
35 return mem.toBytes(x);35 return mem.toBytes(x);
36 }36 }
3737
38 /// Encrypt a block with a round key.38 /// Encrypt a block with a round key.
39 pub inline fn encrypt(block: Block, round_key: Block) Block {39 pub fn encrypt(block: Block, round_key: Block) callconv(.Inline) Block {
40 return Block{40 return Block{
41 .repr = asm (41 .repr = asm (
42 \\ vaesenc %[rk], %[in], %[out]42 \\ vaesenc %[rk], %[in], %[out]
...@@ -48,7 +48,7 @@ pub const Block = struct {...@@ -48,7 +48,7 @@ pub const Block = struct {
48 }48 }
4949
50 /// Encrypt a block with the last round key.50 /// Encrypt a block with the last round key.
51 pub inline fn encryptLast(block: Block, round_key: Block) Block {51 pub fn encryptLast(block: Block, round_key: Block) callconv(.Inline) Block {
52 return Block{52 return Block{
53 .repr = asm (53 .repr = asm (
54 \\ vaesenclast %[rk], %[in], %[out]54 \\ vaesenclast %[rk], %[in], %[out]
...@@ -60,7 +60,7 @@ pub const Block = struct {...@@ -60,7 +60,7 @@ pub const Block = struct {
60 }60 }
6161
62 /// Decrypt a block with a round key.62 /// Decrypt a block with a round key.
63 pub inline fn decrypt(block: Block, inv_round_key: Block) Block {63 pub fn decrypt(block: Block, inv_round_key: Block) callconv(.Inline) Block {
64 return Block{64 return Block{
65 .repr = asm (65 .repr = asm (
66 \\ vaesdec %[rk], %[in], %[out]66 \\ vaesdec %[rk], %[in], %[out]
...@@ -72,7 +72,7 @@ pub const Block = struct {...@@ -72,7 +72,7 @@ pub const Block = struct {
72 }72 }
7373
74 /// Decrypt a block with the last round key.74 /// Decrypt a block with the last round key.
75 pub inline fn decryptLast(block: Block, inv_round_key: Block) Block {75 pub fn decryptLast(block: Block, inv_round_key: Block) callconv(.Inline) Block {
76 return Block{76 return Block{
77 .repr = asm (77 .repr = asm (
78 \\ vaesdeclast %[rk], %[in], %[out]78 \\ vaesdeclast %[rk], %[in], %[out]
...@@ -84,17 +84,17 @@ pub const Block = struct {...@@ -84,17 +84,17 @@ pub const Block = struct {
84 }84 }
8585
86 /// Apply the bitwise XOR operation to the content of two blocks.86 /// Apply the bitwise XOR operation to the content of two blocks.
87 pub inline fn xorBlocks(block1: Block, block2: Block) Block {87 pub fn xorBlocks(block1: Block, block2: Block) callconv(.Inline) Block {
88 return Block{ .repr = block1.repr ^ block2.repr };88 return Block{ .repr = block1.repr ^ block2.repr };
89 }89 }
9090
91 /// Apply the bitwise AND operation to the content of two blocks.91 /// Apply the bitwise AND operation to the content of two blocks.
92 pub inline fn andBlocks(block1: Block, block2: Block) Block {92 pub fn andBlocks(block1: Block, block2: Block) callconv(.Inline) Block {
93 return Block{ .repr = block1.repr & block2.repr };93 return Block{ .repr = block1.repr & block2.repr };
94 }94 }
9595
96 /// Apply the bitwise OR operation to the content of two blocks.96 /// Apply the bitwise OR operation to the content of two blocks.
97 pub inline fn orBlocks(block1: Block, block2: Block) Block {97 pub fn orBlocks(block1: Block, block2: Block) callconv(.Inline) Block {
98 return Block{ .repr = block1.repr | block2.repr };98 return Block{ .repr = block1.repr | block2.repr };
99 }99 }
100100
...@@ -114,7 +114,7 @@ pub const Block = struct {...@@ -114,7 +114,7 @@ pub const Block = struct {
114 };114 };
115115
116 /// Encrypt multiple blocks in parallel, each their own round key.116 /// Encrypt multiple blocks in parallel, each their own round key.
117 pub inline fn encryptParallel(comptime count: usize, blocks: [count]Block, round_keys: [count]Block) [count]Block {117 pub fn encryptParallel(comptime count: usize, blocks: [count]Block, round_keys: [count]Block) callconv(.Inline) [count]Block {
118 comptime var i = 0;118 comptime var i = 0;
119 var out: [count]Block = undefined;119 var out: [count]Block = undefined;
120 inline while (i < count) : (i += 1) {120 inline while (i < count) : (i += 1) {
...@@ -124,7 +124,7 @@ pub const Block = struct {...@@ -124,7 +124,7 @@ pub const Block = struct {
124 }124 }
125125
126 /// Decrypt multiple blocks in parallel, each their own round key.126 /// Decrypt multiple blocks in parallel, each their own round key.
127 pub inline fn decryptParallel(comptime count: usize, blocks: [count]Block, round_keys: [count]Block) [count]Block {127 pub fn decryptParallel(comptime count: usize, blocks: [count]Block, round_keys: [count]Block) callconv(.Inline) [count]Block {
128 comptime var i = 0;128 comptime var i = 0;
129 var out: [count]Block = undefined;129 var out: [count]Block = undefined;
130 inline while (i < count) : (i += 1) {130 inline while (i < count) : (i += 1) {
...@@ -134,7 +134,7 @@ pub const Block = struct {...@@ -134,7 +134,7 @@ pub const Block = struct {
134 }134 }
135135
136 /// Encrypt multiple blocks in parallel with the same round key.136 /// Encrypt multiple blocks in parallel with the same round key.
137 pub inline fn encryptWide(comptime count: usize, blocks: [count]Block, round_key: Block) [count]Block {137 pub fn encryptWide(comptime count: usize, blocks: [count]Block, round_key: Block) callconv(.Inline) [count]Block {
138 comptime var i = 0;138 comptime var i = 0;
139 var out: [count]Block = undefined;139 var out: [count]Block = undefined;
140 inline while (i < count) : (i += 1) {140 inline while (i < count) : (i += 1) {
...@@ -144,7 +144,7 @@ pub const Block = struct {...@@ -144,7 +144,7 @@ pub const Block = struct {
144 }144 }
145145
146 /// Decrypt multiple blocks in parallel with the same round key.146 /// Decrypt multiple blocks in parallel with the same round key.
147 pub inline fn decryptWide(comptime count: usize, blocks: [count]Block, round_key: Block) [count]Block {147 pub fn decryptWide(comptime count: usize, blocks: [count]Block, round_key: Block) callconv(.Inline) [count]Block {
148 comptime var i = 0;148 comptime var i = 0;
149 var out: [count]Block = undefined;149 var out: [count]Block = undefined;
150 inline while (i < count) : (i += 1) {150 inline while (i < count) : (i += 1) {
...@@ -154,7 +154,7 @@ pub const Block = struct {...@@ -154,7 +154,7 @@ pub const Block = struct {
154 }154 }
155155
156 /// Encrypt multiple blocks in parallel with the same last round key.156 /// Encrypt multiple blocks in parallel with the same last round key.
157 pub inline fn encryptLastWide(comptime count: usize, blocks: [count]Block, round_key: Block) [count]Block {157 pub fn encryptLastWide(comptime count: usize, blocks: [count]Block, round_key: Block) callconv(.Inline) [count]Block {
158 comptime var i = 0;158 comptime var i = 0;
159 var out: [count]Block = undefined;159 var out: [count]Block = undefined;
160 inline while (i < count) : (i += 1) {160 inline while (i < count) : (i += 1) {
...@@ -164,7 +164,7 @@ pub const Block = struct {...@@ -164,7 +164,7 @@ pub const Block = struct {
164 }164 }
165165
166 /// Decrypt multiple blocks in parallel with the same last round key.166 /// Decrypt multiple blocks in parallel with the same last round key.
167 pub inline fn decryptLastWide(comptime count: usize, blocks: [count]Block, round_key: Block) [count]Block {167 pub fn decryptLastWide(comptime count: usize, blocks: [count]Block, round_key: Block) callconv(.Inline) [count]Block {
168 comptime var i = 0;168 comptime var i = 0;
169 var out: [count]Block = undefined;169 var out: [count]Block = undefined;
170 inline while (i < count) : (i += 1) {170 inline while (i < count) : (i += 1) {
lib/std/crypto/aes/armcrypto.zig+16-16
...@@ -19,18 +19,18 @@ pub const Block = struct {...@@ -19,18 +19,18 @@ pub const Block = struct {
19 repr: BlockVec,19 repr: BlockVec,
2020
21 /// Convert a byte sequence into an internal representation.21 /// Convert a byte sequence into an internal representation.
22 pub inline fn fromBytes(bytes: *const [16]u8) Block {22 pub fn fromBytes(bytes: *const [16]u8) callconv(.Inline) Block {
23 const repr = mem.bytesToValue(BlockVec, bytes);23 const repr = mem.bytesToValue(BlockVec, bytes);
24 return Block{ .repr = repr };24 return Block{ .repr = repr };
25 }25 }
2626
27 /// Convert the internal representation of a block into a byte sequence.27 /// Convert the internal representation of a block into a byte sequence.
28 pub inline fn toBytes(block: Block) [16]u8 {28 pub fn toBytes(block: Block) callconv(.Inline) [16]u8 {
29 return mem.toBytes(block.repr);29 return mem.toBytes(block.repr);
30 }30 }
3131
32 /// XOR the block with a byte sequence.32 /// XOR the block with a byte sequence.
33 pub inline fn xorBytes(block: Block, bytes: *const [16]u8) [16]u8 {33 pub fn xorBytes(block: Block, bytes: *const [16]u8) callconv(.Inline) [16]u8 {
34 const x = block.repr ^ fromBytes(bytes).repr;34 const x = block.repr ^ fromBytes(bytes).repr;
35 return mem.toBytes(x);35 return mem.toBytes(x);
36 }36 }
...@@ -38,7 +38,7 @@ pub const Block = struct {...@@ -38,7 +38,7 @@ pub const Block = struct {
38 const zero = Vector(2, u64){ 0, 0 };38 const zero = Vector(2, u64){ 0, 0 };
3939
40 /// Encrypt a block with a round key.40 /// Encrypt a block with a round key.
41 pub inline fn encrypt(block: Block, round_key: Block) Block {41 pub fn encrypt(block: Block, round_key: Block) callconv(.Inline) Block {
42 return Block{42 return Block{
43 .repr = asm (43 .repr = asm (
44 \\ mov %[out].16b, %[in].16b44 \\ mov %[out].16b, %[in].16b
...@@ -54,7 +54,7 @@ pub const Block = struct {...@@ -54,7 +54,7 @@ pub const Block = struct {
54 }54 }
5555
56 /// Encrypt a block with the last round key.56 /// Encrypt a block with the last round key.
57 pub inline fn encryptLast(block: Block, round_key: Block) Block {57 pub fn encryptLast(block: Block, round_key: Block) callconv(.Inline) Block {
58 return Block{58 return Block{
59 .repr = asm (59 .repr = asm (
60 \\ mov %[out].16b, %[in].16b60 \\ mov %[out].16b, %[in].16b
...@@ -69,7 +69,7 @@ pub const Block = struct {...@@ -69,7 +69,7 @@ pub const Block = struct {
69 }69 }
7070
71 /// Decrypt a block with a round key.71 /// Decrypt a block with a round key.
72 pub inline fn decrypt(block: Block, inv_round_key: Block) Block {72 pub fn decrypt(block: Block, inv_round_key: Block) callconv(.Inline) Block {
73 return Block{73 return Block{
74 .repr = asm (74 .repr = asm (
75 \\ mov %[out].16b, %[in].16b75 \\ mov %[out].16b, %[in].16b
...@@ -85,7 +85,7 @@ pub const Block = struct {...@@ -85,7 +85,7 @@ pub const Block = struct {
85 }85 }
8686
87 /// Decrypt a block with the last round key.87 /// Decrypt a block with the last round key.
88 pub inline fn decryptLast(block: Block, inv_round_key: Block) Block {88 pub fn decryptLast(block: Block, inv_round_key: Block) callconv(.Inline) Block {
89 return Block{89 return Block{
90 .repr = asm (90 .repr = asm (
91 \\ mov %[out].16b, %[in].16b91 \\ mov %[out].16b, %[in].16b
...@@ -100,17 +100,17 @@ pub const Block = struct {...@@ -100,17 +100,17 @@ pub const Block = struct {
100 }100 }
101101
102 /// Apply the bitwise XOR operation to the content of two blocks.102 /// Apply the bitwise XOR operation to the content of two blocks.
103 pub inline fn xorBlocks(block1: Block, block2: Block) Block {103 pub fn xorBlocks(block1: Block, block2: Block) callconv(.Inline) Block {
104 return Block{ .repr = block1.repr ^ block2.repr };104 return Block{ .repr = block1.repr ^ block2.repr };
105 }105 }
106106
107 /// Apply the bitwise AND operation to the content of two blocks.107 /// Apply the bitwise AND operation to the content of two blocks.
108 pub inline fn andBlocks(block1: Block, block2: Block) Block {108 pub fn andBlocks(block1: Block, block2: Block) callconv(.Inline) Block {
109 return Block{ .repr = block1.repr & block2.repr };109 return Block{ .repr = block1.repr & block2.repr };
110 }110 }
111111
112 /// Apply the bitwise OR operation to the content of two blocks.112 /// Apply the bitwise OR operation to the content of two blocks.
113 pub inline fn orBlocks(block1: Block, block2: Block) Block {113 pub fn orBlocks(block1: Block, block2: Block) callconv(.Inline) Block {
114 return Block{ .repr = block1.repr | block2.repr };114 return Block{ .repr = block1.repr | block2.repr };
115 }115 }
116116
...@@ -120,7 +120,7 @@ pub const Block = struct {...@@ -120,7 +120,7 @@ pub const Block = struct {
120 pub const optimal_parallel_blocks = 8;120 pub const optimal_parallel_blocks = 8;
121121
122 /// Encrypt multiple blocks in parallel, each their own round key.122 /// Encrypt multiple blocks in parallel, each their own round key.
123 pub inline fn encryptParallel(comptime count: usize, blocks: [count]Block, round_keys: [count]Block) [count]Block {123 pub fn encryptParallel(comptime count: usize, blocks: [count]Block, round_keys: [count]Block) callconv(.Inline) [count]Block {
124 comptime var i = 0;124 comptime var i = 0;
125 var out: [count]Block = undefined;125 var out: [count]Block = undefined;
126 inline while (i < count) : (i += 1) {126 inline while (i < count) : (i += 1) {
...@@ -130,7 +130,7 @@ pub const Block = struct {...@@ -130,7 +130,7 @@ pub const Block = struct {
130 }130 }
131131
132 /// Decrypt multiple blocks in parallel, each their own round key.132 /// Decrypt multiple blocks in parallel, each their own round key.
133 pub inline fn decryptParallel(comptime count: usize, blocks: [count]Block, round_keys: [count]Block) [count]Block {133 pub fn decryptParallel(comptime count: usize, blocks: [count]Block, round_keys: [count]Block) callconv(.Inline) [count]Block {
134 comptime var i = 0;134 comptime var i = 0;
135 var out: [count]Block = undefined;135 var out: [count]Block = undefined;
136 inline while (i < count) : (i += 1) {136 inline while (i < count) : (i += 1) {
...@@ -140,7 +140,7 @@ pub const Block = struct {...@@ -140,7 +140,7 @@ pub const Block = struct {
140 }140 }
141141
142 /// Encrypt multiple blocks in parallel with the same round key.142 /// Encrypt multiple blocks in parallel with the same round key.
143 pub inline fn encryptWide(comptime count: usize, blocks: [count]Block, round_key: Block) [count]Block {143 pub fn encryptWide(comptime count: usize, blocks: [count]Block, round_key: Block) callconv(.Inline) [count]Block {
144 comptime var i = 0;144 comptime var i = 0;
145 var out: [count]Block = undefined;145 var out: [count]Block = undefined;
146 inline while (i < count) : (i += 1) {146 inline while (i < count) : (i += 1) {
...@@ -150,7 +150,7 @@ pub const Block = struct {...@@ -150,7 +150,7 @@ pub const Block = struct {
150 }150 }
151151
152 /// Decrypt multiple blocks in parallel with the same round key.152 /// Decrypt multiple blocks in parallel with the same round key.
153 pub inline fn decryptWide(comptime count: usize, blocks: [count]Block, round_key: Block) [count]Block {153 pub fn decryptWide(comptime count: usize, blocks: [count]Block, round_key: Block) callconv(.Inline) [count]Block {
154 comptime var i = 0;154 comptime var i = 0;
155 var out: [count]Block = undefined;155 var out: [count]Block = undefined;
156 inline while (i < count) : (i += 1) {156 inline while (i < count) : (i += 1) {
...@@ -160,7 +160,7 @@ pub const Block = struct {...@@ -160,7 +160,7 @@ pub const Block = struct {
160 }160 }
161161
162 /// Encrypt multiple blocks in parallel with the same last round key.162 /// Encrypt multiple blocks in parallel with the same last round key.
163 pub inline fn encryptLastWide(comptime count: usize, blocks: [count]Block, round_key: Block) [count]Block {163 pub fn encryptLastWide(comptime count: usize, blocks: [count]Block, round_key: Block) callconv(.Inline) [count]Block {
164 comptime var i = 0;164 comptime var i = 0;
165 var out: [count]Block = undefined;165 var out: [count]Block = undefined;
166 inline while (i < count) : (i += 1) {166 inline while (i < count) : (i += 1) {
...@@ -170,7 +170,7 @@ pub const Block = struct {...@@ -170,7 +170,7 @@ pub const Block = struct {
170 }170 }
171171
172 /// Decrypt multiple blocks in parallel with the same last round key.172 /// Decrypt multiple blocks in parallel with the same last round key.
173 pub inline fn decryptLastWide(comptime count: usize, blocks: [count]Block, round_key: Block) [count]Block {173 pub fn decryptLastWide(comptime count: usize, blocks: [count]Block, round_key: Block) callconv(.Inline) [count]Block {
174 comptime var i = 0;174 comptime var i = 0;
175 var out: [count]Block = undefined;175 var out: [count]Block = undefined;
176 inline while (i < count) : (i += 1) {176 inline while (i < count) : (i += 1) {
lib/std/crypto/aes/soft.zig+10-10
...@@ -18,7 +18,7 @@ pub const Block = struct {...@@ -18,7 +18,7 @@ pub const Block = struct {
18 repr: BlockVec align(16),18 repr: BlockVec align(16),
1919
20 /// Convert a byte sequence into an internal representation.20 /// Convert a byte sequence into an internal representation.
21 pub inline fn fromBytes(bytes: *const [16]u8) Block {21 pub fn fromBytes(bytes: *const [16]u8) callconv(.Inline) Block {
22 const s0 = mem.readIntBig(u32, bytes[0..4]);22 const s0 = mem.readIntBig(u32, bytes[0..4]);
23 const s1 = mem.readIntBig(u32, bytes[4..8]);23 const s1 = mem.readIntBig(u32, bytes[4..8]);
24 const s2 = mem.readIntBig(u32, bytes[8..12]);24 const s2 = mem.readIntBig(u32, bytes[8..12]);
...@@ -27,7 +27,7 @@ pub const Block = struct {...@@ -27,7 +27,7 @@ pub const Block = struct {
27 }27 }
2828
29 /// Convert the internal representation of a block into a byte sequence.29 /// Convert the internal representation of a block into a byte sequence.
30 pub inline fn toBytes(block: Block) [16]u8 {30 pub fn toBytes(block: Block) callconv(.Inline) [16]u8 {
31 var bytes: [16]u8 = undefined;31 var bytes: [16]u8 = undefined;
32 mem.writeIntBig(u32, bytes[0..4], block.repr[0]);32 mem.writeIntBig(u32, bytes[0..4], block.repr[0]);
33 mem.writeIntBig(u32, bytes[4..8], block.repr[1]);33 mem.writeIntBig(u32, bytes[4..8], block.repr[1]);
...@@ -37,7 +37,7 @@ pub const Block = struct {...@@ -37,7 +37,7 @@ pub const Block = struct {
37 }37 }
3838
39 /// XOR the block with a byte sequence.39 /// XOR the block with a byte sequence.
40 pub inline fn xorBytes(block: Block, bytes: *const [16]u8) [16]u8 {40 pub fn xorBytes(block: Block, bytes: *const [16]u8) callconv(.Inline) [16]u8 {
41 const block_bytes = block.toBytes();41 const block_bytes = block.toBytes();
42 var x: [16]u8 = undefined;42 var x: [16]u8 = undefined;
43 comptime var i: usize = 0;43 comptime var i: usize = 0;
...@@ -48,7 +48,7 @@ pub const Block = struct {...@@ -48,7 +48,7 @@ pub const Block = struct {
48 }48 }
4949
50 /// Encrypt a block with a round key.50 /// Encrypt a block with a round key.
51 pub inline fn encrypt(block: Block, round_key: Block) Block {51 pub fn encrypt(block: Block, round_key: Block) callconv(.Inline) Block {
52 const src = &block.repr;52 const src = &block.repr;
5353
54 const s0 = block.repr[0];54 const s0 = block.repr[0];
...@@ -65,7 +65,7 @@ pub const Block = struct {...@@ -65,7 +65,7 @@ pub const Block = struct {
65 }65 }
6666
67 /// Encrypt a block with the last round key.67 /// Encrypt a block with the last round key.
68 pub inline fn encryptLast(block: Block, round_key: Block) Block {68 pub fn encryptLast(block: Block, round_key: Block) callconv(.Inline) Block {
69 const src = &block.repr;69 const src = &block.repr;
7070
71 const t0 = block.repr[0];71 const t0 = block.repr[0];
...@@ -87,7 +87,7 @@ pub const Block = struct {...@@ -87,7 +87,7 @@ pub const Block = struct {
87 }87 }
8888
89 /// Decrypt a block with a round key.89 /// Decrypt a block with a round key.
90 pub inline fn decrypt(block: Block, round_key: Block) Block {90 pub fn decrypt(block: Block, round_key: Block) callconv(.Inline) Block {
91 const src = &block.repr;91 const src = &block.repr;
9292
93 const s0 = block.repr[0];93 const s0 = block.repr[0];
...@@ -104,7 +104,7 @@ pub const Block = struct {...@@ -104,7 +104,7 @@ pub const Block = struct {
104 }104 }
105105
106 /// Decrypt a block with the last round key.106 /// Decrypt a block with the last round key.
107 pub inline fn decryptLast(block: Block, round_key: Block) Block {107 pub fn decryptLast(block: Block, round_key: Block) callconv(.Inline) Block {
108 const src = &block.repr;108 const src = &block.repr;
109109
110 const t0 = block.repr[0];110 const t0 = block.repr[0];
...@@ -126,7 +126,7 @@ pub const Block = struct {...@@ -126,7 +126,7 @@ pub const Block = struct {
126 }126 }
127127
128 /// Apply the bitwise XOR operation to the content of two blocks.128 /// Apply the bitwise XOR operation to the content of two blocks.
129 pub inline fn xorBlocks(block1: Block, block2: Block) Block {129 pub fn xorBlocks(block1: Block, block2: Block) callconv(.Inline) Block {
130 var x: BlockVec = undefined;130 var x: BlockVec = undefined;
131 comptime var i = 0;131 comptime var i = 0;
132 inline while (i < 4) : (i += 1) {132 inline while (i < 4) : (i += 1) {
...@@ -136,7 +136,7 @@ pub const Block = struct {...@@ -136,7 +136,7 @@ pub const Block = struct {
136 }136 }
137137
138 /// Apply the bitwise AND operation to the content of two blocks.138 /// Apply the bitwise AND operation to the content of two blocks.
139 pub inline fn andBlocks(block1: Block, block2: Block) Block {139 pub fn andBlocks(block1: Block, block2: Block) callconv(.Inline) Block {
140 var x: BlockVec = undefined;140 var x: BlockVec = undefined;
141 comptime var i = 0;141 comptime var i = 0;
142 inline while (i < 4) : (i += 1) {142 inline while (i < 4) : (i += 1) {
...@@ -146,7 +146,7 @@ pub const Block = struct {...@@ -146,7 +146,7 @@ pub const Block = struct {
146 }146 }
147147
148 /// Apply the bitwise OR operation to the content of two blocks.148 /// Apply the bitwise OR operation to the content of two blocks.
149 pub inline fn orBlocks(block1: Block, block2: Block) Block {149 pub fn orBlocks(block1: Block, block2: Block) callconv(.Inline) Block {
150 var x: BlockVec = undefined;150 var x: BlockVec = undefined;
151 comptime var i = 0;151 comptime var i = 0;
152 inline while (i < 4) : (i += 1) {152 inline while (i < 4) : (i += 1) {
lib/std/crypto/blake3.zig+3-3
...@@ -66,7 +66,7 @@ const CompressVectorized = struct {...@@ -66,7 +66,7 @@ const CompressVectorized = struct {
66 const Lane = Vector(4, u32);66 const Lane = Vector(4, u32);
67 const Rows = [4]Lane;67 const Rows = [4]Lane;
6868
69 inline fn g(comptime even: bool, rows: *Rows, m: Lane) void {69 fn g(comptime even: bool, rows: *Rows, m: Lane) callconv(.Inline) void {
70 rows[0] +%= rows[1] +% m;70 rows[0] +%= rows[1] +% m;
71 rows[3] ^= rows[0];71 rows[3] ^= rows[0];
72 rows[3] = math.rotr(Lane, rows[3], if (even) 8 else 16);72 rows[3] = math.rotr(Lane, rows[3], if (even) 8 else 16);
...@@ -75,13 +75,13 @@ const CompressVectorized = struct {...@@ -75,13 +75,13 @@ const CompressVectorized = struct {
75 rows[1] = math.rotr(Lane, rows[1], if (even) 7 else 12);75 rows[1] = math.rotr(Lane, rows[1], if (even) 7 else 12);
76 }76 }
7777
78 inline fn diagonalize(rows: *Rows) void {78 fn diagonalize(rows: *Rows) callconv(.Inline) void {
79 rows[0] = @shuffle(u32, rows[0], undefined, [_]i32{ 3, 0, 1, 2 });79 rows[0] = @shuffle(u32, rows[0], undefined, [_]i32{ 3, 0, 1, 2 });
80 rows[3] = @shuffle(u32, rows[3], undefined, [_]i32{ 2, 3, 0, 1 });80 rows[3] = @shuffle(u32, rows[3], undefined, [_]i32{ 2, 3, 0, 1 });
81 rows[2] = @shuffle(u32, rows[2], undefined, [_]i32{ 1, 2, 3, 0 });81 rows[2] = @shuffle(u32, rows[2], undefined, [_]i32{ 1, 2, 3, 0 });
82 }82 }
8383
84 inline fn undiagonalize(rows: *Rows) void {84 fn undiagonalize(rows: *Rows) callconv(.Inline) void {
85 rows[0] = @shuffle(u32, rows[0], undefined, [_]i32{ 1, 2, 3, 0 });85 rows[0] = @shuffle(u32, rows[0], undefined, [_]i32{ 1, 2, 3, 0 });
86 rows[3] = @shuffle(u32, rows[3], undefined, [_]i32{ 2, 3, 0, 1 });86 rows[3] = @shuffle(u32, rows[3], undefined, [_]i32{ 2, 3, 0, 1 });
87 rows[2] = @shuffle(u32, rows[2], undefined, [_]i32{ 3, 0, 1, 2 });87 rows[2] = @shuffle(u32, rows[2], undefined, [_]i32{ 3, 0, 1, 2 });
lib/std/crypto/chacha20.zig+6-6
...@@ -35,7 +35,7 @@ const ChaCha20VecImpl = struct {...@@ -35,7 +35,7 @@ const ChaCha20VecImpl = struct {
35 };35 };
36 }36 }
3737
38 inline fn chacha20Core(x: *BlockVec, input: BlockVec) void {38 fn chacha20Core(x: *BlockVec, input: BlockVec) callconv(.Inline) void {
39 x.* = input;39 x.* = input;
4040
41 var r: usize = 0;41 var r: usize = 0;
...@@ -80,7 +80,7 @@ const ChaCha20VecImpl = struct {...@@ -80,7 +80,7 @@ const ChaCha20VecImpl = struct {
80 }80 }
81 }81 }
8282
83 inline fn hashToBytes(out: *[64]u8, x: BlockVec) void {83 fn hashToBytes(out: *[64]u8, x: BlockVec) callconv(.Inline) void {
84 var i: usize = 0;84 var i: usize = 0;
85 while (i < 4) : (i += 1) {85 while (i < 4) : (i += 1) {
86 mem.writeIntLittle(u32, out[16 * i + 0 ..][0..4], x[i][0]);86 mem.writeIntLittle(u32, out[16 * i + 0 ..][0..4], x[i][0]);
...@@ -90,7 +90,7 @@ const ChaCha20VecImpl = struct {...@@ -90,7 +90,7 @@ const ChaCha20VecImpl = struct {
90 }90 }
91 }91 }
9292
93 inline fn contextFeedback(x: *BlockVec, ctx: BlockVec) void {93 fn contextFeedback(x: *BlockVec, ctx: BlockVec) callconv(.Inline) void {
94 x[0] +%= ctx[0];94 x[0] +%= ctx[0];
95 x[1] +%= ctx[1];95 x[1] +%= ctx[1];
96 x[2] +%= ctx[2];96 x[2] +%= ctx[2];
...@@ -190,7 +190,7 @@ const ChaCha20NonVecImpl = struct {...@@ -190,7 +190,7 @@ const ChaCha20NonVecImpl = struct {
190 };190 };
191 }191 }
192192
193 inline fn chacha20Core(x: *BlockVec, input: BlockVec) void {193 fn chacha20Core(x: *BlockVec, input: BlockVec) callconv(.Inline) void {
194 x.* = input;194 x.* = input;
195195
196 const rounds = comptime [_]QuarterRound{196 const rounds = comptime [_]QuarterRound{
...@@ -219,7 +219,7 @@ const ChaCha20NonVecImpl = struct {...@@ -219,7 +219,7 @@ const ChaCha20NonVecImpl = struct {
219 }219 }
220 }220 }
221221
222 inline fn hashToBytes(out: *[64]u8, x: BlockVec) void {222 fn hashToBytes(out: *[64]u8, x: BlockVec) callconv(.Inline) void {
223 var i: usize = 0;223 var i: usize = 0;
224 while (i < 4) : (i += 1) {224 while (i < 4) : (i += 1) {
225 mem.writeIntLittle(u32, out[16 * i + 0 ..][0..4], x[i * 4 + 0]);225 mem.writeIntLittle(u32, out[16 * i + 0 ..][0..4], x[i * 4 + 0]);
...@@ -229,7 +229,7 @@ const ChaCha20NonVecImpl = struct {...@@ -229,7 +229,7 @@ const ChaCha20NonVecImpl = struct {
229 }229 }
230 }230 }
231231
232 inline fn contextFeedback(x: *BlockVec, ctx: BlockVec) void {232 fn contextFeedback(x: *BlockVec, ctx: BlockVec) callconv(.Inline) void {
233 var i: usize = 0;233 var i: usize = 0;
234 while (i < 16) : (i += 1) {234 while (i < 16) : (i += 1) {
235 x[i] +%= ctx[i];235 x[i] +%= ctx[i];
lib/std/crypto/ghash.zig+2-2
...@@ -95,7 +95,7 @@ pub const Ghash = struct {...@@ -95,7 +95,7 @@ pub const Ghash = struct {
95 }95 }
96 }96 }
9797
98 inline fn clmul_pclmul(x: u64, y: u64) u64 {98 fn clmul_pclmul(x: u64, y: u64) callconv(.Inline) u64 {
99 const Vector = std.meta.Vector;99 const Vector = std.meta.Vector;
100 const product = asm (100 const product = asm (
101 \\ vpclmulqdq $0x00, %[x], %[y], %[out]101 \\ vpclmulqdq $0x00, %[x], %[y], %[out]
...@@ -106,7 +106,7 @@ pub const Ghash = struct {...@@ -106,7 +106,7 @@ pub const Ghash = struct {
106 return product[0];106 return product[0];
107 }107 }
108108
109 inline fn clmul_pmull(x: u64, y: u64) u64 {109 fn clmul_pmull(x: u64, y: u64) callconv(.Inline) u64 {
110 const Vector = std.meta.Vector;110 const Vector = std.meta.Vector;
111 const product = asm (111 const product = asm (
112 \\ pmull %[out].1q, %[x].1d, %[y].1d112 \\ pmull %[out].1q, %[x].1d, %[y].1d
lib/std/crypto/gimli.zig+2-2
...@@ -48,7 +48,7 @@ pub const State = struct {...@@ -48,7 +48,7 @@ pub const State = struct {
48 return mem.asBytes(&self.data);48 return mem.asBytes(&self.data);
49 }49 }
5050
51 inline fn endianSwap(self: *Self) void {51 fn endianSwap(self: *Self) callconv(.Inline) void {
52 for (self.data) |*w| {52 for (self.data) |*w| {
53 w.* = mem.littleToNative(u32, w.*);53 w.* = mem.littleToNative(u32, w.*);
54 }54 }
...@@ -116,7 +116,7 @@ pub const State = struct {...@@ -116,7 +116,7 @@ pub const State = struct {
116116
117 const Lane = Vector(4, u32);117 const Lane = Vector(4, u32);
118118
119 inline fn shift(x: Lane, comptime n: comptime_int) Lane {119 fn shift(x: Lane, comptime n: comptime_int) callconv(.Inline) Lane {
120 return x << @splat(4, @as(u5, n));120 return x << @splat(4, @as(u5, n));
121 }121 }
122122
lib/std/crypto/salsa20.zig+3-3
...@@ -37,7 +37,7 @@ const Salsa20VecImpl = struct {...@@ -37,7 +37,7 @@ const Salsa20VecImpl = struct {
37 };37 };
38 }38 }
3939
40 inline fn salsa20Core(x: *BlockVec, input: BlockVec, comptime feedback: bool) void {40 fn salsa20Core(x: *BlockVec, input: BlockVec, comptime feedback: bool) callconv(.Inline) void {
41 const n1n2n3n0 = Lane{ input[3][1], input[3][2], input[3][3], input[3][0] };41 const n1n2n3n0 = Lane{ input[3][1], input[3][2], input[3][3], input[3][0] };
42 const n1n2 = Half{ n1n2n3n0[0], n1n2n3n0[1] };42 const n1n2 = Half{ n1n2n3n0[0], n1n2n3n0[1] };
43 const n3n0 = Half{ n1n2n3n0[2], n1n2n3n0[3] };43 const n3n0 = Half{ n1n2n3n0[2], n1n2n3n0[3] };
...@@ -211,7 +211,7 @@ const Salsa20NonVecImpl = struct {...@@ -211,7 +211,7 @@ const Salsa20NonVecImpl = struct {
211 d: u6,211 d: u6,
212 };212 };
213213
214 inline fn Rp(a: usize, b: usize, c: usize, d: u6) QuarterRound {214 fn Rp(a: usize, b: usize, c: usize, d: u6) callconv(.Inline) QuarterRound {
215 return QuarterRound{215 return QuarterRound{
216 .a = a,216 .a = a,
217 .b = b,217 .b = b,
...@@ -220,7 +220,7 @@ const Salsa20NonVecImpl = struct {...@@ -220,7 +220,7 @@ const Salsa20NonVecImpl = struct {
220 };220 };
221 }221 }
222222
223 inline fn salsa20Core(x: *BlockVec, input: BlockVec, comptime feedback: bool) void {223 fn salsa20Core(x: *BlockVec, input: BlockVec, comptime feedback: bool) callconv(.Inline) void {
224 const arx_steps = comptime [_]QuarterRound{224 const arx_steps = comptime [_]QuarterRound{
225 Rp(4, 0, 12, 7), Rp(8, 4, 0, 9), Rp(12, 8, 4, 13), Rp(0, 12, 8, 18),225 Rp(4, 0, 12, 7), Rp(8, 4, 0, 9), Rp(12, 8, 4, 13), Rp(0, 12, 8, 18),
226 Rp(9, 5, 1, 7), Rp(13, 9, 5, 9), Rp(1, 13, 9, 13), Rp(5, 1, 13, 18),226 Rp(9, 5, 1, 7), Rp(13, 9, 5, 9), Rp(1, 13, 9, 13), Rp(5, 1, 13, 18),
lib/std/elf.zig+8-8
...@@ -720,10 +720,10 @@ pub const Elf32_Rel = extern struct {...@@ -720,10 +720,10 @@ pub const Elf32_Rel = extern struct {
720 r_offset: Elf32_Addr,720 r_offset: Elf32_Addr,
721 r_info: Elf32_Word,721 r_info: Elf32_Word,
722722
723 pub inline fn r_sym(self: @This()) u24 {723 pub fn r_sym(self: @This()) callconv(.Inline) u24 {
724 return @truncate(u24, self.r_info >> 8);724 return @truncate(u24, self.r_info >> 8);
725 }725 }
726 pub inline fn r_type(self: @This()) u8 {726 pub fn r_type(self: @This()) callconv(.Inline) u8 {
727 return @truncate(u8, self.r_info & 0xff);727 return @truncate(u8, self.r_info & 0xff);
728 }728 }
729};729};
...@@ -731,10 +731,10 @@ pub const Elf64_Rel = extern struct {...@@ -731,10 +731,10 @@ pub const Elf64_Rel = extern struct {
731 r_offset: Elf64_Addr,731 r_offset: Elf64_Addr,
732 r_info: Elf64_Xword,732 r_info: Elf64_Xword,
733733
734 pub inline fn r_sym(self: @This()) u32 {734 pub fn r_sym(self: @This()) callconv(.Inline) u32 {
735 return @truncate(u32, self.r_info >> 32);735 return @truncate(u32, self.r_info >> 32);
736 }736 }
737 pub inline fn r_type(self: @This()) u32 {737 pub fn r_type(self: @This()) callconv(.Inline) u32 {
738 return @truncate(u32, self.r_info & 0xffffffff);738 return @truncate(u32, self.r_info & 0xffffffff);
739 }739 }
740};740};
...@@ -743,10 +743,10 @@ pub const Elf32_Rela = extern struct {...@@ -743,10 +743,10 @@ pub const Elf32_Rela = extern struct {
743 r_info: Elf32_Word,743 r_info: Elf32_Word,
744 r_addend: Elf32_Sword,744 r_addend: Elf32_Sword,
745745
746 pub inline fn r_sym(self: @This()) u24 {746 pub fn r_sym(self: @This()) callconv(.Inline) u24 {
747 return @truncate(u24, self.r_info >> 8);747 return @truncate(u24, self.r_info >> 8);
748 }748 }
749 pub inline fn r_type(self: @This()) u8 {749 pub fn r_type(self: @This()) callconv(.Inline) u8 {
750 return @truncate(u8, self.r_info & 0xff);750 return @truncate(u8, self.r_info & 0xff);
751 }751 }
752};752};
...@@ -755,10 +755,10 @@ pub const Elf64_Rela = extern struct {...@@ -755,10 +755,10 @@ pub const Elf64_Rela = extern struct {
755 r_info: Elf64_Xword,755 r_info: Elf64_Xword,
756 r_addend: Elf64_Sxword,756 r_addend: Elf64_Sxword,
757757
758 pub inline fn r_sym(self: @This()) u32 {758 pub fn r_sym(self: @This()) callconv(.Inline) u32 {
759 return @truncate(u32, self.r_info >> 32);759 return @truncate(u32, self.r_info >> 32);
760 }760 }
761 pub inline fn r_type(self: @This()) u32 {761 pub fn r_type(self: @This()) callconv(.Inline) u32 {
762 return @truncate(u32, self.r_info & 0xffffffff);762 return @truncate(u32, self.r_info & 0xffffffff);
763 }763 }
764};764};
lib/std/fmt/parse_float.zig+4-4
...@@ -52,21 +52,21 @@ const Z96 = struct {...@@ -52,21 +52,21 @@ const Z96 = struct {
52 d2: u32,52 d2: u32,
5353
54 // d = s >> 154 // d = s >> 1
55 inline fn shiftRight1(d: *Z96, s: Z96) void {55 fn shiftRight1(d: *Z96, s: Z96) callconv(.Inline) void {
56 d.d0 = (s.d0 >> 1) | ((s.d1 & 1) << 31);56 d.d0 = (s.d0 >> 1) | ((s.d1 & 1) << 31);
57 d.d1 = (s.d1 >> 1) | ((s.d2 & 1) << 31);57 d.d1 = (s.d1 >> 1) | ((s.d2 & 1) << 31);
58 d.d2 = s.d2 >> 1;58 d.d2 = s.d2 >> 1;
59 }59 }
6060
61 // d = s << 161 // d = s << 1
62 inline fn shiftLeft1(d: *Z96, s: Z96) void {62 fn shiftLeft1(d: *Z96, s: Z96) callconv(.Inline) void {
63 d.d2 = (s.d2 << 1) | ((s.d1 & (1 << 31)) >> 31);63 d.d2 = (s.d2 << 1) | ((s.d1 & (1 << 31)) >> 31);
64 d.d1 = (s.d1 << 1) | ((s.d0 & (1 << 31)) >> 31);64 d.d1 = (s.d1 << 1) | ((s.d0 & (1 << 31)) >> 31);
65 d.d0 = s.d0 << 1;65 d.d0 = s.d0 << 1;
66 }66 }
6767
68 // d += s68 // d += s
69 inline fn add(d: *Z96, s: Z96) void {69 fn add(d: *Z96, s: Z96) callconv(.Inline) void {
70 var w = @as(u64, d.d0) + @as(u64, s.d0);70 var w = @as(u64, d.d0) + @as(u64, s.d0);
71 d.d0 = @truncate(u32, w);71 d.d0 = @truncate(u32, w);
7272
...@@ -80,7 +80,7 @@ const Z96 = struct {...@@ -80,7 +80,7 @@ const Z96 = struct {
80 }80 }
8181
82 // d -= s82 // d -= s
83 inline fn sub(d: *Z96, s: Z96) void {83 fn sub(d: *Z96, s: Z96) callconv(.Inline) void {
84 var w = @as(u64, d.d0) -% @as(u64, s.d0);84 var w = @as(u64, d.d0) -% @as(u64, s.d0);
85 d.d0 = @truncate(u32, w);85 d.d0 = @truncate(u32, w);
8686
lib/std/hash/cityhash.zig+1-1
...@@ -6,7 +6,7 @@...@@ -6,7 +6,7 @@
6const std = @import("std");6const std = @import("std");
7const builtin = @import("builtin");7const builtin = @import("builtin");
88
9inline fn offsetPtr(ptr: [*]const u8, offset: usize) [*]const u8 {9fn offsetPtr(ptr: [*]const u8, offset: usize) callconv(.Inline) [*]const u8 {
10 // ptr + offset doesn't work at comptime so we need this instead.10 // ptr + offset doesn't work at comptime so we need this instead.
11 return @ptrCast([*]const u8, &ptr[offset]);11 return @ptrCast([*]const u8, &ptr[offset]);
12}12}
lib/std/os/bits/freebsd.zig+4-4
...@@ -815,16 +815,16 @@ pub const sigval = extern union {...@@ -815,16 +815,16 @@ pub const sigval = extern union {
815pub const _SIG_WORDS = 4;815pub const _SIG_WORDS = 4;
816pub const _SIG_MAXSIG = 128;816pub const _SIG_MAXSIG = 128;
817817
818pub inline fn _SIG_IDX(sig: usize) usize {818pub fn _SIG_IDX(sig: usize) callconv(.Inline) usize {
819 return sig - 1;819 return sig - 1;
820}820}
821pub inline fn _SIG_WORD(sig: usize) usize {821pub fn _SIG_WORD(sig: usize) callconv(.Inline) usize {
822 return_SIG_IDX(sig) >> 5;822 return_SIG_IDX(sig) >> 5;
823}823}
824pub inline fn _SIG_BIT(sig: usize) usize {824pub fn _SIG_BIT(sig: usize) callconv(.Inline) usize {
825 return 1 << (_SIG_IDX(sig) & 31);825 return 1 << (_SIG_IDX(sig) & 31);
826}826}
827pub inline fn _SIG_VALID(sig: usize) usize {827pub fn _SIG_VALID(sig: usize) callconv(.Inline) usize {
828 return sig <= _SIG_MAXSIG and sig > 0;828 return sig <= _SIG_MAXSIG and sig > 0;
829}829}
830830
lib/std/os/bits/netbsd.zig+4-4
...@@ -796,16 +796,16 @@ pub const _ksiginfo = extern struct {...@@ -796,16 +796,16 @@ pub const _ksiginfo = extern struct {
796pub const _SIG_WORDS = 4;796pub const _SIG_WORDS = 4;
797pub const _SIG_MAXSIG = 128;797pub const _SIG_MAXSIG = 128;
798798
799pub inline fn _SIG_IDX(sig: usize) usize {799pub fn _SIG_IDX(sig: usize) callconv(.Inline) usize {
800 return sig - 1;800 return sig - 1;
801}801}
802pub inline fn _SIG_WORD(sig: usize) usize {802pub fn _SIG_WORD(sig: usize) callconv(.Inline) usize {
803 return_SIG_IDX(sig) >> 5;803 return_SIG_IDX(sig) >> 5;
804}804}
805pub inline fn _SIG_BIT(sig: usize) usize {805pub fn _SIG_BIT(sig: usize) callconv(.Inline) usize {
806 return 1 << (_SIG_IDX(sig) & 31);806 return 1 << (_SIG_IDX(sig) & 31);
807}807}
808pub inline fn _SIG_VALID(sig: usize) usize {808pub fn _SIG_VALID(sig: usize) callconv(.Inline) usize {
809 return sig <= _SIG_MAXSIG and sig > 0;809 return sig <= _SIG_MAXSIG and sig > 0;
810}810}
811811
lib/std/os/linux.zig+1-1
...@@ -126,7 +126,7 @@ pub fn fork() usize {...@@ -126,7 +126,7 @@ pub fn fork() usize {
126/// It is advised to avoid this function and use clone instead, because126/// It is advised to avoid this function and use clone instead, because
127/// the compiler is not aware of how vfork affects control flow and you may127/// the compiler is not aware of how vfork affects control flow and you may
128/// see different results in optimized builds.128/// see different results in optimized builds.
129pub inline fn vfork() usize {129pub fn vfork() callconv(.Inline) usize {
130 return @call(.{ .modifier = .always_inline }, syscall0, .{.vfork});130 return @call(.{ .modifier = .always_inline }, syscall0, .{.vfork});
131}131}
132132
lib/std/os/linux/tls.zig+1-1
...@@ -300,7 +300,7 @@ fn initTLS() void {...@@ -300,7 +300,7 @@ fn initTLS() void {
300 };300 };
301}301}
302302
303inline fn alignPtrCast(comptime T: type, ptr: [*]u8) *T {303fn alignPtrCast(comptime T: type, ptr: [*]u8) callconv(.Inline) *T {
304 return @ptrCast(*T, @alignCast(@alignOf(*T), ptr));304 return @ptrCast(*T, @alignCast(@alignOf(*T), ptr));
305}305}
306306
lib/std/os/windows.zig+1-1
...@@ -1669,7 +1669,7 @@ pub fn wToPrefixedFileW(s: []const u16) !PathSpace {...@@ -1669,7 +1669,7 @@ pub fn wToPrefixedFileW(s: []const u16) !PathSpace {
1669 return path_space;1669 return path_space;
1670}1670}
16711671
1672inline fn MAKELANGID(p: c_ushort, s: c_ushort) LANGID {1672fn MAKELANGID(p: c_ushort, s: c_ushort) callconv(.Inline) LANGID {
1673 return (s << 10) | p;1673 return (s << 10) | p;
1674}1674}
16751675
lib/std/start.zig+2-2
...@@ -262,7 +262,7 @@ const bad_main_ret = "expected return type of main to be 'void', '!void', 'noret...@@ -262,7 +262,7 @@ const bad_main_ret = "expected return type of main to be 'void', '!void', 'noret
262262
263// This is marked inline because for some reason LLVM in release mode fails to inline it,263// This is marked inline because for some reason LLVM in release mode fails to inline it,
264// and we want fewer call frames in stack traces.264// and we want fewer call frames in stack traces.
265inline fn initEventLoopAndCallMain() u8 {265fn initEventLoopAndCallMain() callconv(.Inline) u8 {
266 if (std.event.Loop.instance) |loop| {266 if (std.event.Loop.instance) |loop| {
267 if (!@hasDecl(root, "event_loop")) {267 if (!@hasDecl(root, "event_loop")) {
268 loop.init() catch |err| {268 loop.init() catch |err| {
...@@ -291,7 +291,7 @@ inline fn initEventLoopAndCallMain() u8 {...@@ -291,7 +291,7 @@ inline fn initEventLoopAndCallMain() u8 {
291// and we want fewer call frames in stack traces.291// and we want fewer call frames in stack traces.
292// TODO This function is duplicated from initEventLoopAndCallMain instead of using generics292// TODO This function is duplicated from initEventLoopAndCallMain instead of using generics
293// because it is working around stage1 compiler bugs.293// because it is working around stage1 compiler bugs.
294inline fn initEventLoopAndCallWinMain() std.os.windows.INT {294fn initEventLoopAndCallWinMain() callconv(.Inline) std.os.windows.INT {
295 if (std.event.Loop.instance) |loop| {295 if (std.event.Loop.instance) |loop| {
296 if (!@hasDecl(root, "event_loop")) {296 if (!@hasDecl(root, "event_loop")) {
297 loop.init() catch |err| {297 loop.init() catch |err| {
lib/std/zig/parser_test.zig+3-3
...@@ -2355,17 +2355,17 @@ test "zig fmt: functions" {...@@ -2355,17 +2355,17 @@ test "zig fmt: functions" {
2355 \\extern fn puts(s: *const u8) c_int;2355 \\extern fn puts(s: *const u8) c_int;
2356 \\extern "c" fn puts(s: *const u8) c_int;2356 \\extern "c" fn puts(s: *const u8) c_int;
2357 \\export fn puts(s: *const u8) c_int;2357 \\export fn puts(s: *const u8) c_int;
2358 \\inline fn puts(s: *const u8) c_int;2358 \\fn puts(s: *const u8) callconv(.Inline) c_int;
2359 \\noinline fn puts(s: *const u8) c_int;2359 \\noinline fn puts(s: *const u8) c_int;
2360 \\pub extern fn puts(s: *const u8) c_int;2360 \\pub extern fn puts(s: *const u8) c_int;
2361 \\pub extern "c" fn puts(s: *const u8) c_int;2361 \\pub extern "c" fn puts(s: *const u8) c_int;
2362 \\pub export fn puts(s: *const u8) c_int;2362 \\pub export fn puts(s: *const u8) c_int;
2363 \\pub inline fn puts(s: *const u8) c_int;2363 \\pub fn puts(s: *const u8) callconv(.Inline) c_int;
2364 \\pub noinline fn puts(s: *const u8) c_int;2364 \\pub noinline fn puts(s: *const u8) c_int;
2365 \\pub extern fn puts(s: *const u8) align(2 + 2) c_int;2365 \\pub extern fn puts(s: *const u8) align(2 + 2) c_int;
2366 \\pub extern "c" fn puts(s: *const u8) align(2 + 2) c_int;2366 \\pub extern "c" fn puts(s: *const u8) align(2 + 2) c_int;
2367 \\pub export fn puts(s: *const u8) align(2 + 2) c_int;2367 \\pub export fn puts(s: *const u8) align(2 + 2) c_int;
2368 \\pub inline fn puts(s: *const u8) align(2 + 2) c_int;2368 \\pub fn puts(s: *const u8) align(2 + 2) callconv(.Inline) c_int;
2369 \\pub noinline fn puts(s: *const u8) align(2 + 2) c_int;2369 \\pub noinline fn puts(s: *const u8) align(2 + 2) c_int;
2370 \\2370 \\
2371 );2371 );
lib/std/zig/system/x86.zig+2-2
...@@ -19,11 +19,11 @@ fn setFeature(cpu: *Target.Cpu, feature: Target.x86.Feature, enabled: bool) void...@@ -19,11 +19,11 @@ fn setFeature(cpu: *Target.Cpu, feature: Target.x86.Feature, enabled: bool) void
19 if (enabled) cpu.features.addFeature(idx) else cpu.features.removeFeature(idx);19 if (enabled) cpu.features.addFeature(idx) else cpu.features.removeFeature(idx);
20}20}
2121
22inline fn bit(input: u32, offset: u5) bool {22fn bit(input: u32, offset: u5) callconv(.Inline) bool {
23 return (input >> offset) & 1 != 0;23 return (input >> offset) & 1 != 0;
24}24}
2525
26inline fn hasMask(input: u32, mask: u32) bool {26fn hasMask(input: u32, mask: u32) callconv(.Inline) bool {
27 return (input & mask) == mask;27 return (input & mask) == mask;
28}28}
2929
src/link/MachO.zig+1-1
...@@ -2366,7 +2366,7 @@ fn allocatedSizeLinkedit(self: *MachO, start: u64) u64 {...@@ -2366,7 +2366,7 @@ fn allocatedSizeLinkedit(self: *MachO, start: u64) u64 {
2366 return min_pos - start;2366 return min_pos - start;
2367}2367}
23682368
2369inline fn checkForCollision(start: u64, end: u64, off: u64, size: u64) ?u64 {2369fn checkForCollision(start: u64, end: u64, off: u64, size: u64) callconv(.Inline) ?u64 {
2370 const increased_size = padToIdeal(size);2370 const increased_size = padToIdeal(size);
2371 const test_end = off + increased_size;2371 const test_end = off + increased_size;
2372 if (end > off and start < test_end) {2372 if (end > off and start < test_end) {
src/tracy.zig+1-1
...@@ -31,7 +31,7 @@ pub const Ctx = if (enable) ___tracy_c_zone_context else struct {...@@ -31,7 +31,7 @@ pub const Ctx = if (enable) ___tracy_c_zone_context else struct {
31 pub fn end(self: Ctx) void {}31 pub fn end(self: Ctx) void {}
32};32};
3333
34pub inline fn trace(comptime src: std.builtin.SourceLocation) Ctx {34pub fn trace(comptime src: std.builtin.SourceLocation) callconv(.Inline) Ctx {
35 if (!enable) return .{};35 if (!enable) return .{};
3636
37 const loc: ___tracy_source_location_data = .{37 const loc: ___tracy_source_location_data = .{
test/cli.zig+1-1
...@@ -113,7 +113,7 @@ fn testGodboltApi(zig_exe: []const u8, dir_path: []const u8) anyerror!void {...@@ -113,7 +113,7 @@ fn testGodboltApi(zig_exe: []const u8, dir_path: []const u8) anyerror!void {
113 \\ return num * num;113 \\ return num * num;
114 \\}114 \\}
115 \\extern fn zig_panic() noreturn;115 \\extern fn zig_panic() noreturn;
116 \\pub inline fn panic(msg: []const u8, error_return_trace: ?*@import("builtin").StackTrace) noreturn {116 \\pub fn panic(msg: []const u8, error_return_trace: ?*@import("builtin").StackTrace) callconv(.Inline) noreturn {
117 \\ zig_panic();117 \\ zig_panic();
118 \\}118 \\}
119 );119 );
test/compile_errors.zig+6-6
...@@ -1648,7 +1648,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {...@@ -1648,7 +1648,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
1648 \\ @call(.{ .modifier = .compile_time }, baz, .{});1648 \\ @call(.{ .modifier = .compile_time }, baz, .{});
1649 \\}1649 \\}
1650 \\fn foo() void {}1650 \\fn foo() void {}
1651 \\inline fn bar() void {}1651 \\fn bar() callconv(.Inline) void {}
1652 \\fn baz1() void {}1652 \\fn baz1() void {}
1653 \\fn baz2() void {}1653 \\fn baz2() void {}
1654 , &[_][]const u8{1654 , &[_][]const u8{
...@@ -3944,7 +3944,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {...@@ -3944,7 +3944,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
3944 \\export fn entry() void {3944 \\export fn entry() void {
3945 \\ var a = b;3945 \\ var a = b;
3946 \\}3946 \\}
3947 \\inline fn b() void { }3947 \\fn b() callconv(.Inline) void { }
3948 , &[_][]const u8{3948 , &[_][]const u8{
3949 "tmp.zig:2:5: error: functions marked inline must be stored in const or comptime var",3949 "tmp.zig:2:5: error: functions marked inline must be stored in const or comptime var",
3950 "tmp.zig:4:1: note: declared here",3950 "tmp.zig:4:1: note: declared here",
...@@ -6782,11 +6782,11 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {...@@ -6782,11 +6782,11 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
6782 // \\export fn foo() void {6782 // \\export fn foo() void {
6783 // \\ bar();6783 // \\ bar();
6784 // \\}6784 // \\}
6785 // \\inline fn bar() void {6785 // \\fn bar() callconv(.Inline) void {
6786 // \\ baz();6786 // \\ baz();
6787 // \\ quux();6787 // \\ quux();
6788 // \\}6788 // \\}
6789 // \\inline fn baz() void {6789 // \\fn baz() callconv(.Inline) void {
6790 // \\ bar();6790 // \\ bar();
6791 // \\ quux();6791 // \\ quux();
6792 // \\}6792 // \\}
...@@ -6799,7 +6799,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {...@@ -6799,7 +6799,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
6799 // \\export fn foo() void {6799 // \\export fn foo() void {
6800 // \\ quux(@ptrToInt(bar));6800 // \\ quux(@ptrToInt(bar));
6801 // \\}6801 // \\}
6802 // \\inline fn bar() void { }6802 // \\fn bar() callconv(.Inline) void { }
6803 // \\extern fn quux(usize) void;6803 // \\extern fn quux(usize) void;
6804 //, &[_][]const u8{6804 //, &[_][]const u8{
6805 // "tmp.zig:4:1: error: unable to inline function",6805 // "tmp.zig:4:1: error: unable to inline function",
...@@ -7207,7 +7207,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {...@@ -7207,7 +7207,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
7207 \\export fn entry() void {7207 \\export fn entry() void {
7208 \\ foo();7208 \\ foo();
7209 \\}7209 \\}
7210 \\inline fn foo() void {7210 \\fn foo() callconv(.Inline) void {
7211 \\ @setAlignStack(16);7211 \\ @setAlignStack(16);
7212 \\}7212 \\}
7213 , &[_][]const u8{7213 , &[_][]const u8{
test/stage1/behavior/fn.zig+1-1
...@@ -113,7 +113,7 @@ test "assign inline fn to const variable" {...@@ -113,7 +113,7 @@ test "assign inline fn to const variable" {
113 a();113 a();
114}114}
115115
116inline fn inlineFn() void {}116fn inlineFn() callconv(.Inline) void {}
117117
118test "pass by non-copying value" {118test "pass by non-copying value" {
119 expect(addPointCoords(Point{ .x = 1, .y = 2 }) == 3);119 expect(addPointCoords(Point{ .x = 1, .y = 2 }) == 3);
test/stage2/cbe.zig+1-1
...@@ -179,7 +179,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -179,7 +179,7 @@ pub fn addCases(ctx: *TestContext) !void {
179 \\ return y - 1;179 \\ return y - 1;
180 \\}180 \\}
181 \\181 \\
182 \\inline fn rec(n: usize) usize {182 \\fn rec(n: usize) callconv(.Inline) usize {
183 \\ if (n <= 1) return n;183 \\ if (n <= 1) return n;
184 \\ return rec(n - 1);184 \\ return rec(n - 1);
185 \\}185 \\}
test/stage2/test.zig+5-5
...@@ -255,7 +255,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -255,7 +255,7 @@ pub fn addCases(ctx: *TestContext) !void {
255 \\ exit(y - 6);255 \\ exit(y - 6);
256 \\}256 \\}
257 \\257 \\
258 \\inline fn add(a: usize, b: usize, c: usize) usize {258 \\fn add(a: usize, b: usize, c: usize) callconv(.Inline) usize {
259 \\ return a + b + c;259 \\ return a + b + c;
260 \\}260 \\}
261 \\261 \\
...@@ -1228,7 +1228,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -1228,7 +1228,7 @@ pub fn addCases(ctx: *TestContext) !void {
1228 \\ exit(y - 6);1228 \\ exit(y - 6);
1229 \\}1229 \\}
1230 \\1230 \\
1231 \\inline fn add(a: usize, b: usize, c: usize) usize {1231 \\fn add(a: usize, b: usize, c: usize) callconv(.Inline) usize {
1232 \\ if (a == 10) @compileError("bad");1232 \\ if (a == 10) @compileError("bad");
1233 \\ return a + b + c;1233 \\ return a + b + c;
1234 \\}1234 \\}
...@@ -1251,7 +1251,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -1251,7 +1251,7 @@ pub fn addCases(ctx: *TestContext) !void {
1251 \\ exit(y - 6);1251 \\ exit(y - 6);
1252 \\}1252 \\}
1253 \\1253 \\
1254 \\inline fn add(a: usize, b: usize, c: usize) usize {1254 \\fn add(a: usize, b: usize, c: usize) callconv(.Inline) usize {
1255 \\ if (a == 10) @compileError("bad");1255 \\ if (a == 10) @compileError("bad");
1256 \\ return a + b + c;1256 \\ return a + b + c;
1257 \\}1257 \\}
...@@ -1277,7 +1277,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -1277,7 +1277,7 @@ pub fn addCases(ctx: *TestContext) !void {
1277 \\ exit(y - 21);1277 \\ exit(y - 21);
1278 \\}1278 \\}
1279 \\1279 \\
1280 \\inline fn fibonacci(n: usize) usize {1280 \\fn fibonacci(n: usize) callconv(.Inline) usize {
1281 \\ if (n <= 2) return n;1281 \\ if (n <= 2) return n;
1282 \\ return fibonacci(n - 2) + fibonacci(n - 1);1282 \\ return fibonacci(n - 2) + fibonacci(n - 1);
1283 \\}1283 \\}
...@@ -1300,7 +1300,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -1300,7 +1300,7 @@ pub fn addCases(ctx: *TestContext) !void {
1300 \\ exit(y - 21);1300 \\ exit(y - 21);
1301 \\}1301 \\}
1302 \\1302 \\
1303 \\inline fn fibonacci(n: usize) usize {1303 \\fn fibonacci(n: usize) callconv(.Inline) usize {
1304 \\ if (n <= 2) return n;1304 \\ if (n <= 2) return n;
1305 \\ return fibonacci(n - 2) + fibonacci(n - 1);1305 \\ return fibonacci(n - 2) + fibonacci(n - 1);
1306 \\}1306 \\}
test/translate_c.zig+16-16
...@@ -43,7 +43,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void {...@@ -43,7 +43,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void {
43 ,43 ,
44 \\pub const VALUE = ((((1 + (2 * 3)) + (4 * 5)) + 6) << 7) | @boolToInt(8 == 9);44 \\pub const VALUE = ((((1 + (2 * 3)) + (4 * 5)) + 6) << 7) | @boolToInt(8 == 9);
45 ,45 ,
46 \\pub inline fn _AL_READ3BYTES(p: anytype) @TypeOf(((@import("std").meta.cast([*c]u8, p)).* | (((@import("std").meta.cast([*c]u8, p)) + 1).* << 8)) | (((@import("std").meta.cast([*c]u8, p)) + 2).* << 16)) {46 \\pub fn _AL_READ3BYTES(p: anytype) callconv(.Inline) @TypeOf(((@import("std").meta.cast([*c]u8, p)).* | (((@import("std").meta.cast([*c]u8, p)) + 1).* << 8)) | (((@import("std").meta.cast([*c]u8, p)) + 2).* << 16)) {
47 \\ return ((@import("std").meta.cast([*c]u8, p)).* | (((@import("std").meta.cast([*c]u8, p)) + 1).* << 8)) | (((@import("std").meta.cast([*c]u8, p)) + 2).* << 16);47 \\ return ((@import("std").meta.cast([*c]u8, p)).* | (((@import("std").meta.cast([*c]u8, p)) + 1).* << 8)) | (((@import("std").meta.cast([*c]u8, p)) + 2).* << 16);
48 \\}48 \\}
49 });49 });
...@@ -116,7 +116,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void {...@@ -116,7 +116,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void {
116 \\};116 \\};
117 \\pub const Color = struct_Color;117 \\pub const Color = struct_Color;
118 ,118 ,
119 \\pub inline fn CLITERAL(type_1: anytype) @TypeOf(type_1) {119 \\pub fn CLITERAL(type_1: anytype) callconv(.Inline) @TypeOf(type_1) {
120 \\ return type_1;120 \\ return type_1;
121 \\}121 \\}
122 ,122 ,
...@@ -148,7 +148,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void {...@@ -148,7 +148,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void {
148 cases.add("correct semicolon after infixop",148 cases.add("correct semicolon after infixop",
149 \\#define __ferror_unlocked_body(_fp) (((_fp)->_flags & _IO_ERR_SEEN) != 0)149 \\#define __ferror_unlocked_body(_fp) (((_fp)->_flags & _IO_ERR_SEEN) != 0)
150 , &[_][]const u8{150 , &[_][]const u8{
151 \\pub inline fn __ferror_unlocked_body(_fp: anytype) @TypeOf(((_fp.*._flags) & _IO_ERR_SEEN) != 0) {151 \\pub fn __ferror_unlocked_body(_fp: anytype) callconv(.Inline) @TypeOf(((_fp.*._flags) & _IO_ERR_SEEN) != 0) {
152 \\ return ((_fp.*._flags) & _IO_ERR_SEEN) != 0;152 \\ return ((_fp.*._flags) & _IO_ERR_SEEN) != 0;
153 \\}153 \\}
154 });154 });
...@@ -157,7 +157,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void {...@@ -157,7 +157,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void {
157 \\#define FOO(x) ((x >= 0) + (x >= 0))157 \\#define FOO(x) ((x >= 0) + (x >= 0))
158 \\#define BAR 1 && 2 > 4158 \\#define BAR 1 && 2 > 4
159 , &[_][]const u8{159 , &[_][]const u8{
160 \\pub inline fn FOO(x: anytype) @TypeOf(@boolToInt(x >= 0) + @boolToInt(x >= 0)) {160 \\pub fn FOO(x: anytype) callconv(.Inline) @TypeOf(@boolToInt(x >= 0) + @boolToInt(x >= 0)) {
161 \\ return @boolToInt(x >= 0) + @boolToInt(x >= 0);161 \\ return @boolToInt(x >= 0) + @boolToInt(x >= 0);
162 \\}162 \\}
163 ,163 ,
...@@ -208,7 +208,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void {...@@ -208,7 +208,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void {
208 \\ break :blk bar;208 \\ break :blk bar;
209 \\};209 \\};
210 ,210 ,
211 \\pub inline fn bar(x: anytype) @TypeOf(baz(1, 2)) {211 \\pub fn bar(x: anytype) callconv(.Inline) @TypeOf(baz(1, 2)) {
212 \\ return blk: {212 \\ return blk: {
213 \\ _ = &x;213 \\ _ = &x;
214 \\ _ = 3;214 \\ _ = 3;
...@@ -1590,13 +1590,13 @@ pub fn addCases(cases: *tests.TranslateCContext) void {...@@ -1590,13 +1590,13 @@ pub fn addCases(cases: *tests.TranslateCContext) void {
1590 , &[_][]const u8{1590 , &[_][]const u8{
1591 \\pub extern var fn_ptr: ?fn () callconv(.C) void;1591 \\pub extern var fn_ptr: ?fn () callconv(.C) void;
1592 ,1592 ,
1593 \\pub inline fn foo() void {1593 \\pub fn foo() callconv(.Inline) void {
1594 \\ return fn_ptr.?();1594 \\ return fn_ptr.?();
1595 \\}1595 \\}
1596 ,1596 ,
1597 \\pub extern var fn_ptr2: ?fn (c_int, f32) callconv(.C) u8;1597 \\pub extern var fn_ptr2: ?fn (c_int, f32) callconv(.C) u8;
1598 ,1598 ,
1599 \\pub inline fn bar(arg_1: c_int, arg_2: f32) u8 {1599 \\pub fn bar(arg_1: c_int, arg_2: f32) callconv(.Inline) u8 {
1600 \\ return fn_ptr2.?(arg_1, arg_2);1600 \\ return fn_ptr2.?(arg_1, arg_2);
1601 \\}1601 \\}
1602 });1602 });
...@@ -1629,7 +1629,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void {...@@ -1629,7 +1629,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void {
1629 ,1629 ,
1630 \\pub const glClearPFN = PFNGLCLEARPROC;1630 \\pub const glClearPFN = PFNGLCLEARPROC;
1631 ,1631 ,
1632 \\pub inline fn glClearUnion(arg_2: GLbitfield) void {1632 \\pub fn glClearUnion(arg_2: GLbitfield) callconv(.Inline) void {
1633 \\ return glProcs.gl.Clear.?(arg_2);1633 \\ return glProcs.gl.Clear.?(arg_2);
1634 \\}1634 \\}
1635 ,1635 ,
...@@ -1650,15 +1650,15 @@ pub fn addCases(cases: *tests.TranslateCContext) void {...@@ -1650,15 +1650,15 @@ pub fn addCases(cases: *tests.TranslateCContext) void {
1650 , &[_][]const u8{1650 , &[_][]const u8{
1651 \\pub extern var c: c_int;1651 \\pub extern var c: c_int;
1652 ,1652 ,
1653 \\pub inline fn BASIC(c_1: anytype) @TypeOf(c_1 * 2) {1653 \\pub fn BASIC(c_1: anytype) callconv(.Inline) @TypeOf(c_1 * 2) {
1654 \\ return c_1 * 2;1654 \\ return c_1 * 2;
1655 \\}1655 \\}
1656 ,1656 ,
1657 \\pub inline fn FOO(L: anytype, b: anytype) @TypeOf(L + b) {1657 \\pub fn FOO(L: anytype, b: anytype) callconv(.Inline) @TypeOf(L + b) {
1658 \\ return L + b;1658 \\ return L + b;
1659 \\}1659 \\}
1660 ,1660 ,
1661 \\pub inline fn BAR() @TypeOf(c * c) {1661 \\pub fn BAR() callconv(.Inline) @TypeOf(c * c) {
1662 \\ return c * c;1662 \\ return c * c;
1663 \\}1663 \\}
1664 });1664 });
...@@ -2298,7 +2298,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void {...@@ -2298,7 +2298,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void {
2298 cases.add("macro call",2298 cases.add("macro call",
2299 \\#define CALL(arg) bar(arg)2299 \\#define CALL(arg) bar(arg)
2300 , &[_][]const u8{2300 , &[_][]const u8{
2301 \\pub inline fn CALL(arg: anytype) @TypeOf(bar(arg)) {2301 \\pub fn CALL(arg: anytype) callconv(.Inline) @TypeOf(bar(arg)) {
2302 \\ return bar(arg);2302 \\ return bar(arg);
2303 \\}2303 \\}
2304 });2304 });
...@@ -2860,7 +2860,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void {...@@ -2860,7 +2860,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void {
2860 \\#define BAR (void*) a2860 \\#define BAR (void*) a
2861 \\#define BAZ (uint32_t)(2)2861 \\#define BAZ (uint32_t)(2)
2862 , &[_][]const u8{2862 , &[_][]const u8{
2863 \\pub inline fn FOO(bar: anytype) @TypeOf(baz((@import("std").meta.cast(?*c_void, baz)))) {2863 \\pub fn FOO(bar: anytype) callconv(.Inline) @TypeOf(baz((@import("std").meta.cast(?*c_void, baz)))) {
2864 \\ return baz((@import("std").meta.cast(?*c_void, baz)));2864 \\ return baz((@import("std").meta.cast(?*c_void, baz)));
2865 \\}2865 \\}
2866 ,2866 ,
...@@ -2902,11 +2902,11 @@ pub fn addCases(cases: *tests.TranslateCContext) void {...@@ -2902,11 +2902,11 @@ pub fn addCases(cases: *tests.TranslateCContext) void {
2902 \\#define MIN(a, b) ((b) < (a) ? (b) : (a))2902 \\#define MIN(a, b) ((b) < (a) ? (b) : (a))
2903 \\#define MAX(a, b) ((b) > (a) ? (b) : (a))2903 \\#define MAX(a, b) ((b) > (a) ? (b) : (a))
2904 , &[_][]const u8{2904 , &[_][]const u8{
2905 \\pub inline fn MIN(a: anytype, b: anytype) @TypeOf(if (b < a) b else a) {2905 \\pub fn MIN(a: anytype, b: anytype) callconv(.Inline) @TypeOf(if (b < a) b else a) {
2906 \\ return if (b < a) b else a;2906 \\ return if (b < a) b else a;
2907 \\}2907 \\}
2908 ,2908 ,
2909 \\pub inline fn MAX(a: anytype, b: anytype) @TypeOf(if (b > a) b else a) {2909 \\pub fn MAX(a: anytype, b: anytype) callconv(.Inline) @TypeOf(if (b > a) b else a) {
2910 \\ return if (b > a) b else a;2910 \\ return if (b > a) b else a;
2911 \\}2911 \\}
2912 });2912 });
...@@ -3094,7 +3094,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void {...@@ -3094,7 +3094,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void {
3094 \\#define DefaultScreen(dpy) (((_XPrivDisplay)(dpy))->default_screen)3094 \\#define DefaultScreen(dpy) (((_XPrivDisplay)(dpy))->default_screen)
3095 \\3095 \\
3096 , &[_][]const u8{3096 , &[_][]const u8{
3097 \\pub inline fn DefaultScreen(dpy: anytype) @TypeOf((@import("std").meta.cast(_XPrivDisplay, dpy)).*.default_screen) {3097 \\pub fn DefaultScreen(dpy: anytype) callconv(.Inline) @TypeOf((@import("std").meta.cast(_XPrivDisplay, dpy)).*.default_screen) {
3098 \\ return (@import("std").meta.cast(_XPrivDisplay, dpy)).*.default_screen;3098 \\ return (@import("std").meta.cast(_XPrivDisplay, dpy)).*.default_screen;
3099 \\}3099 \\}
3100 });3100 });