Run zig fmt on src/ and lib/std/

This replaces callconv(.Inline) with the more idiomatic inline keyword.
This commit is contained in:
Isaac Freund 2021-05-20 17:07:06 +02:00
parent 4a582734fd
commit 5b850d5c92
No known key found for this signature in database
GPG Key ID: 86DED400DDFD7A11
41 changed files with 244 additions and 306 deletions

View File

@ -68,7 +68,7 @@ else switch (std.Target.current.os.tag) {
};
/// Signals the processor that it is inside a busy-wait spin-loop ("spin lock").
pub fn spinLoopHint() callconv(.Inline) void {
pub inline fn spinLoopHint() void {
switch (std.Target.current.cpu.arch) {
.i386, .x86_64 => {
asm volatile ("pause" ::: "memory");

View File

@ -83,7 +83,7 @@ pub fn IntegerBitSet(comptime size: u16) type {
}
/// Returns the number of bits in this bit set
pub fn capacity(self: Self) callconv(.Inline) usize {
pub inline fn capacity(self: Self) usize {
return bit_length;
}
@ -310,7 +310,7 @@ pub fn ArrayBitSet(comptime MaskIntType: type, comptime size: usize) type {
}
/// Returns the number of bits in this bit set
pub fn capacity(self: Self) callconv(.Inline) usize {
pub inline fn capacity(self: Self) usize {
return bit_length;
}
@ -574,7 +574,7 @@ pub const DynamicBitSetUnmanaged = struct {
}
/// Returns the number of bits in this bit set
pub fn capacity(self: Self) callconv(.Inline) usize {
pub inline fn capacity(self: Self) usize {
return self.bit_length;
}
@ -789,7 +789,7 @@ pub const DynamicBitSet = struct {
}
/// Returns the number of bits in this bit set
pub fn capacity(self: Self) callconv(.Inline) usize {
pub inline fn capacity(self: Self) usize {
return self.unmanaged.capacity();
}
@ -969,7 +969,7 @@ fn BitSetIterator(comptime MaskInt: type, comptime options: IteratorOptions) typ
// isn't a next word. If the next word is the
// last word, mask off the padding bits so we
// don't visit them.
fn nextWord(self: *Self, comptime is_first_word: bool) callconv(.Inline) void {
inline fn nextWord(self: *Self, comptime is_first_word: bool) void {
var word = switch (direction) {
.forward => self.words_remain[0],
.reverse => self.words_remain[self.words_remain.len - 1],

View File

@ -6,136 +6,136 @@
const std = @import("std");
pub fn __builtin_bswap16(val: u16) callconv(.Inline) u16 {
pub inline fn __builtin_bswap16(val: u16) u16 {
return @byteSwap(u16, val);
}
pub fn __builtin_bswap32(val: u32) callconv(.Inline) u32 {
pub inline fn __builtin_bswap32(val: u32) u32 {
return @byteSwap(u32, val);
}
pub fn __builtin_bswap64(val: u64) callconv(.Inline) u64 {
pub inline fn __builtin_bswap64(val: u64) u64 {
return @byteSwap(u64, val);
}
pub fn __builtin_signbit(val: f64) callconv(.Inline) c_int {
pub inline fn __builtin_signbit(val: f64) c_int {
return @boolToInt(std.math.signbit(val));
}
pub fn __builtin_signbitf(val: f32) callconv(.Inline) c_int {
pub inline fn __builtin_signbitf(val: f32) c_int {
return @boolToInt(std.math.signbit(val));
}
pub fn __builtin_popcount(val: c_uint) callconv(.Inline) c_int {
pub inline fn __builtin_popcount(val: c_uint) c_int {
// popcount of a c_uint will never exceed the capacity of a c_int
@setRuntimeSafety(false);
return @bitCast(c_int, @as(c_uint, @popCount(c_uint, val)));
}
pub fn __builtin_ctz(val: c_uint) callconv(.Inline) c_int {
pub inline fn __builtin_ctz(val: c_uint) c_int {
// Returns the number of trailing 0-bits in val, starting at the least significant bit position.
// In C if `val` is 0, the result is undefined; in zig it's the number of bits in a c_uint
@setRuntimeSafety(false);
return @bitCast(c_int, @as(c_uint, @ctz(c_uint, val)));
}
pub fn __builtin_clz(val: c_uint) callconv(.Inline) c_int {
pub inline fn __builtin_clz(val: c_uint) c_int {
// Returns the number of leading 0-bits in x, starting at the most significant bit position.
// In C if `val` is 0, the result is undefined; in zig it's the number of bits in a c_uint
@setRuntimeSafety(false);
return @bitCast(c_int, @as(c_uint, @clz(c_uint, val)));
}
pub fn __builtin_sqrt(val: f64) callconv(.Inline) f64 {
pub inline fn __builtin_sqrt(val: f64) f64 {
return @sqrt(val);
}
pub fn __builtin_sqrtf(val: f32) callconv(.Inline) f32 {
pub inline fn __builtin_sqrtf(val: f32) f32 {
return @sqrt(val);
}
pub fn __builtin_sin(val: f64) callconv(.Inline) f64 {
pub inline fn __builtin_sin(val: f64) f64 {
return @sin(val);
}
pub fn __builtin_sinf(val: f32) callconv(.Inline) f32 {
pub inline fn __builtin_sinf(val: f32) f32 {
return @sin(val);
}
pub fn __builtin_cos(val: f64) callconv(.Inline) f64 {
pub inline fn __builtin_cos(val: f64) f64 {
return @cos(val);
}
pub fn __builtin_cosf(val: f32) callconv(.Inline) f32 {
pub inline fn __builtin_cosf(val: f32) f32 {
return @cos(val);
}
pub fn __builtin_exp(val: f64) callconv(.Inline) f64 {
pub inline fn __builtin_exp(val: f64) f64 {
return @exp(val);
}
pub fn __builtin_expf(val: f32) callconv(.Inline) f32 {
pub inline fn __builtin_expf(val: f32) f32 {
return @exp(val);
}
pub fn __builtin_exp2(val: f64) callconv(.Inline) f64 {
pub inline fn __builtin_exp2(val: f64) f64 {
return @exp2(val);
}
pub fn __builtin_exp2f(val: f32) callconv(.Inline) f32 {
pub inline fn __builtin_exp2f(val: f32) f32 {
return @exp2(val);
}
pub fn __builtin_log(val: f64) callconv(.Inline) f64 {
pub inline fn __builtin_log(val: f64) f64 {
return @log(val);
}
pub fn __builtin_logf(val: f32) callconv(.Inline) f32 {
pub inline fn __builtin_logf(val: f32) f32 {
return @log(val);
}
pub fn __builtin_log2(val: f64) callconv(.Inline) f64 {
pub inline fn __builtin_log2(val: f64) f64 {
return @log2(val);
}
pub fn __builtin_log2f(val: f32) callconv(.Inline) f32 {
pub inline fn __builtin_log2f(val: f32) f32 {
return @log2(val);
}
pub fn __builtin_log10(val: f64) callconv(.Inline) f64 {
pub inline fn __builtin_log10(val: f64) f64 {
return @log10(val);
}
pub fn __builtin_log10f(val: f32) callconv(.Inline) f32 {
pub inline fn __builtin_log10f(val: f32) f32 {
return @log10(val);
}
// Standard C Library bug: The absolute value of the most negative integer remains negative.
pub fn __builtin_abs(val: c_int) callconv(.Inline) c_int {
pub inline fn __builtin_abs(val: c_int) c_int {
return std.math.absInt(val) catch std.math.minInt(c_int);
}
pub fn __builtin_fabs(val: f64) callconv(.Inline) f64 {
pub inline fn __builtin_fabs(val: f64) f64 {
return @fabs(val);
}
pub fn __builtin_fabsf(val: f32) callconv(.Inline) f32 {
pub inline fn __builtin_fabsf(val: f32) f32 {
return @fabs(val);
}
pub fn __builtin_floor(val: f64) callconv(.Inline) f64 {
pub inline fn __builtin_floor(val: f64) f64 {
return @floor(val);
}
pub fn __builtin_floorf(val: f32) callconv(.Inline) f32 {
pub inline fn __builtin_floorf(val: f32) f32 {
return @floor(val);
}
pub fn __builtin_ceil(val: f64) callconv(.Inline) f64 {
pub inline fn __builtin_ceil(val: f64) f64 {
return @ceil(val);
}
pub fn __builtin_ceilf(val: f32) callconv(.Inline) f32 {
pub inline fn __builtin_ceilf(val: f32) f32 {
return @ceil(val);
}
pub fn __builtin_trunc(val: f64) callconv(.Inline) f64 {
pub inline fn __builtin_trunc(val: f64) f64 {
return @trunc(val);
}
pub fn __builtin_truncf(val: f32) callconv(.Inline) f32 {
pub inline fn __builtin_truncf(val: f32) f32 {
return @trunc(val);
}
pub fn __builtin_round(val: f64) callconv(.Inline) f64 {
pub inline fn __builtin_round(val: f64) f64 {
return @round(val);
}
pub fn __builtin_roundf(val: f32) callconv(.Inline) f32 {
pub inline fn __builtin_roundf(val: f32) f32 {
return @round(val);
}
pub fn __builtin_strlen(s: [*c]const u8) callconv(.Inline) usize {
pub inline fn __builtin_strlen(s: [*c]const u8) usize {
return std.mem.lenZ(s);
}
pub fn __builtin_strcmp(s1: [*c]const u8, s2: [*c]const u8) callconv(.Inline) c_int {
pub inline fn __builtin_strcmp(s1: [*c]const u8, s2: [*c]const u8) c_int {
return @as(c_int, std.cstr.cmp(s1, s2));
}
pub fn __builtin_object_size(ptr: ?*const c_void, ty: c_int) callconv(.Inline) usize {
pub inline fn __builtin_object_size(ptr: ?*const c_void, ty: c_int) usize {
// clang semantics match gcc's: https://gcc.gnu.org/onlinedocs/gcc/Object-Size-Checking.html
// If it is not possible to determine which objects ptr points to at compile time,
// __builtin_object_size should return (size_t) -1 for type 0 or 1 and (size_t) 0
@ -145,37 +145,37 @@ pub fn __builtin_object_size(ptr: ?*const c_void, ty: c_int) callconv(.Inline) u
unreachable;
}
pub fn __builtin___memset_chk(
pub inline fn __builtin___memset_chk(
dst: ?*c_void,
val: c_int,
len: usize,
remaining: usize,
) callconv(.Inline) ?*c_void {
) ?*c_void {
if (len > remaining) @panic("std.c.builtins.memset_chk called with len > remaining");
return __builtin_memset(dst, val, len);
}
pub fn __builtin_memset(dst: ?*c_void, val: c_int, len: usize) callconv(.Inline) ?*c_void {
pub inline fn __builtin_memset(dst: ?*c_void, val: c_int, len: usize) ?*c_void {
const dst_cast = @ptrCast([*c]u8, dst);
@memset(dst_cast, @bitCast(u8, @truncate(i8, val)), len);
return dst;
}
pub fn __builtin___memcpy_chk(
pub inline fn __builtin___memcpy_chk(
noalias dst: ?*c_void,
noalias src: ?*const c_void,
len: usize,
remaining: usize,
) callconv(.Inline) ?*c_void {
) ?*c_void {
if (len > remaining) @panic("std.c.builtins.memcpy_chk called with len > remaining");
return __builtin_memcpy(dst, src, len);
}
pub fn __builtin_memcpy(
pub inline fn __builtin_memcpy(
noalias dst: ?*c_void,
noalias src: ?*const c_void,
len: usize,
) callconv(.Inline) ?*c_void {
) ?*c_void {
const dst_cast = @ptrCast([*c]u8, dst);
const src_cast = @ptrCast([*c]const u8, src);
@ -185,7 +185,7 @@ pub fn __builtin_memcpy(
/// The return value of __builtin_expect is `expr`. `c` is the expected value
/// of `expr` and is used as a hint to the compiler in C. Here it is unused.
pub fn __builtin_expect(expr: c_long, c: c_long) callconv(.Inline) c_long {
pub inline fn __builtin_expect(expr: c_long, c: c_long) c_long {
return expr;
}

View File

@ -209,7 +209,7 @@ pub fn InflateStream(comptime ReaderType: type) type {
// Insert a single byte into the window.
// Assumes there's enough space.
fn appendUnsafe(self: *WSelf, value: u8) callconv(.Inline) void {
inline fn appendUnsafe(self: *WSelf, value: u8) void {
self.buf[self.wi] = value;
self.wi = (self.wi + 1) & (self.buf.len - 1);
self.el += 1;

View File

@ -20,12 +20,12 @@ pub const Curve25519 = struct {
x: Fe,
/// Decode a Curve25519 point from its compressed (X) coordinates.
pub fn fromBytes(s: [32]u8) callconv(.Inline) Curve25519 {
pub inline fn fromBytes(s: [32]u8) Curve25519 {
return .{ .x = Fe.fromBytes(s) };
}
/// Encode a Curve25519 point.
pub fn toBytes(p: Curve25519) callconv(.Inline) [32]u8 {
pub inline fn toBytes(p: Curve25519) [32]u8 {
return p.x.toBytes();
}

View File

@ -91,7 +91,7 @@ pub const Edwards25519 = struct {
}
/// Flip the sign of the X coordinate.
pub fn neg(p: Edwards25519) callconv(.Inline) Edwards25519 {
pub inline fn neg(p: Edwards25519) Edwards25519 {
return .{ .x = p.x.neg(), .y = p.y, .z = p.z, .t = p.t.neg() };
}
@ -136,14 +136,14 @@ pub const Edwards25519 = struct {
return p.add(q.neg());
}
fn cMov(p: *Edwards25519, a: Edwards25519, c: u64) callconv(.Inline) void {
inline fn cMov(p: *Edwards25519, a: Edwards25519, c: u64) void {
p.x.cMov(a.x, c);
p.y.cMov(a.y, c);
p.z.cMov(a.z, c);
p.t.cMov(a.t, c);
}
fn pcSelect(comptime n: usize, pc: [n]Edwards25519, b: u8) callconv(.Inline) Edwards25519 {
inline fn pcSelect(comptime n: usize, pc: [n]Edwards25519, b: u8) Edwards25519 {
var t = Edwards25519.identityElement;
comptime var i: u8 = 1;
inline while (i < pc.len) : (i += 1) {

View File

@ -56,7 +56,7 @@ pub const Fe = struct {
pub const edwards25519sqrtam2 = Fe{ .limbs = .{ 1693982333959686, 608509411481997, 2235573344831311, 947681270984193, 266558006233600 } };
/// Return true if the field element is zero
pub fn isZero(fe: Fe) callconv(.Inline) bool {
pub inline fn isZero(fe: Fe) bool {
var reduced = fe;
reduced.reduce();
const limbs = reduced.limbs;
@ -64,7 +64,7 @@ pub const Fe = struct {
}
/// Return true if both field elements are equivalent
pub fn equivalent(a: Fe, b: Fe) callconv(.Inline) bool {
pub inline fn equivalent(a: Fe, b: Fe) bool {
return a.sub(b).isZero();
}
@ -168,7 +168,7 @@ pub const Fe = struct {
}
/// Add a field element
pub fn add(a: Fe, b: Fe) callconv(.Inline) Fe {
pub inline fn add(a: Fe, b: Fe) Fe {
var fe: Fe = undefined;
comptime var i = 0;
inline while (i < 5) : (i += 1) {
@ -178,7 +178,7 @@ pub const Fe = struct {
}
/// Substract a field elememnt
pub fn sub(a: Fe, b: Fe) callconv(.Inline) Fe {
pub inline fn sub(a: Fe, b: Fe) Fe {
var fe = b;
comptime var i = 0;
inline while (i < 4) : (i += 1) {
@ -197,17 +197,17 @@ pub const Fe = struct {
}
/// Negate a field element
pub fn neg(a: Fe) callconv(.Inline) Fe {
pub inline fn neg(a: Fe) Fe {
return zero.sub(a);
}
/// Return true if a field element is negative
pub fn isNegative(a: Fe) callconv(.Inline) bool {
pub inline fn isNegative(a: Fe) bool {
return (a.toBytes()[0] & 1) != 0;
}
/// Conditonally replace a field element with `a` if `c` is positive
pub fn cMov(fe: *Fe, a: Fe, c: u64) callconv(.Inline) void {
pub inline fn cMov(fe: *Fe, a: Fe, c: u64) void {
const mask: u64 = 0 -% c;
var x = fe.*;
comptime var i = 0;
@ -248,7 +248,7 @@ pub const Fe = struct {
}
}
fn _carry128(r: *[5]u128) callconv(.Inline) Fe {
inline fn _carry128(r: *[5]u128) Fe {
var rs: [5]u64 = undefined;
comptime var i = 0;
inline while (i < 4) : (i += 1) {
@ -269,7 +269,7 @@ pub const Fe = struct {
}
/// Multiply two field elements
pub fn mul(a: Fe, b: Fe) callconv(.Inline) Fe {
pub inline fn mul(a: Fe, b: Fe) Fe {
var ax: [5]u128 = undefined;
var bx: [5]u128 = undefined;
var a19: [5]u128 = undefined;
@ -292,7 +292,7 @@ pub const Fe = struct {
return _carry128(&r);
}
fn _sq(a: Fe, comptime double: bool) callconv(.Inline) Fe {
inline fn _sq(a: Fe, comptime double: bool) Fe {
var ax: [5]u128 = undefined;
var r: [5]u128 = undefined;
comptime var i = 0;
@ -321,17 +321,17 @@ pub const Fe = struct {
}
/// Square a field element
pub fn sq(a: Fe) callconv(.Inline) Fe {
pub inline fn sq(a: Fe) Fe {
return _sq(a, false);
}
/// Square and double a field element
pub fn sq2(a: Fe) callconv(.Inline) Fe {
pub inline fn sq2(a: Fe) Fe {
return _sq(a, true);
}
/// Multiply a field element with a small (32-bit) integer
pub fn mul32(a: Fe, comptime n: u32) callconv(.Inline) Fe {
pub inline fn mul32(a: Fe, comptime n: u32) Fe {
const sn = @intCast(u128, n);
var fe: Fe = undefined;
var x: u128 = 0;
@ -346,7 +346,7 @@ pub const Fe = struct {
}
/// Square a field element `n` times
fn sqn(a: Fe, comptime n: comptime_int) callconv(.Inline) Fe {
inline fn sqn(a: Fe, comptime n: comptime_int) Fe {
var i: usize = 0;
var fe = a;
while (i < n) : (i += 1) {

View File

@ -47,7 +47,7 @@ pub const Ristretto255 = struct {
}
/// Reject the neutral element.
pub fn rejectIdentity(p: Ristretto255) callconv(.Inline) IdentityElementError!void {
pub inline fn rejectIdentity(p: Ristretto255) IdentityElementError!void {
return p.p.rejectIdentity();
}
@ -146,19 +146,19 @@ pub const Ristretto255 = struct {
}
/// Double a Ristretto255 element.
pub fn dbl(p: Ristretto255) callconv(.Inline) Ristretto255 {
pub inline fn dbl(p: Ristretto255) Ristretto255 {
return .{ .p = p.p.dbl() };
}
/// Add two Ristretto255 elements.
pub fn add(p: Ristretto255, q: Ristretto255) callconv(.Inline) Ristretto255 {
pub inline fn add(p: Ristretto255, q: Ristretto255) Ristretto255 {
return .{ .p = p.p.add(q.p) };
}
/// Multiply a Ristretto255 element with a scalar.
/// Return error.WeakPublicKey if the resulting element is
/// the identity element.
pub fn mul(p: Ristretto255, s: [encoded_length]u8) callconv(.Inline) (IdentityElementError || WeakPublicKeyError)!Ristretto255 {
pub inline fn mul(p: Ristretto255, s: [encoded_length]u8) (IdentityElementError || WeakPublicKeyError)!Ristretto255 {
return Ristretto255{ .p = try p.p.mul(s) };
}

View File

@ -48,7 +48,7 @@ pub fn reduce64(s: [64]u8) [32]u8 {
/// Perform the X25519 "clamping" operation.
/// The scalar is then guaranteed to be a multiple of the cofactor.
pub fn clamp(s: *[32]u8) callconv(.Inline) void {
pub inline fn clamp(s: *[32]u8) void {
s[0] &= 248;
s[31] = (s[31] & 127) | 64;
}

View File

@ -36,7 +36,7 @@ const State128L = struct {
return state;
}
fn update(state: *State128L, d1: AesBlock, d2: AesBlock) callconv(.Inline) void {
inline fn update(state: *State128L, d1: AesBlock, d2: AesBlock) void {
const blocks = &state.blocks;
const tmp = blocks[7];
comptime var i: usize = 7;
@ -208,7 +208,7 @@ const State256 = struct {
return state;
}
fn update(state: *State256, d: AesBlock) callconv(.Inline) void {
inline fn update(state: *State256, d: AesBlock) void {
const blocks = &state.blocks;
const tmp = blocks[5].encrypt(blocks[0]);
comptime var i: usize = 5;

View File

@ -19,24 +19,24 @@ pub const Block = struct {
repr: BlockVec,
/// Convert a byte sequence into an internal representation.
pub fn fromBytes(bytes: *const [16]u8) callconv(.Inline) Block {
pub inline fn fromBytes(bytes: *const [16]u8) Block {
const repr = mem.bytesToValue(BlockVec, bytes);
return Block{ .repr = repr };
}
/// Convert the internal representation of a block into a byte sequence.
pub fn toBytes(block: Block) callconv(.Inline) [16]u8 {
pub inline fn toBytes(block: Block) [16]u8 {
return mem.toBytes(block.repr);
}
/// XOR the block with a byte sequence.
pub fn xorBytes(block: Block, bytes: *const [16]u8) callconv(.Inline) [16]u8 {
pub inline fn xorBytes(block: Block, bytes: *const [16]u8) [16]u8 {
const x = block.repr ^ fromBytes(bytes).repr;
return mem.toBytes(x);
}
/// Encrypt a block with a round key.
pub fn encrypt(block: Block, round_key: Block) callconv(.Inline) Block {
pub inline fn encrypt(block: Block, round_key: Block) Block {
return Block{
.repr = asm (
\\ vaesenc %[rk], %[in], %[out]
@ -48,7 +48,7 @@ pub const Block = struct {
}
/// Encrypt a block with the last round key.
pub fn encryptLast(block: Block, round_key: Block) callconv(.Inline) Block {
pub inline fn encryptLast(block: Block, round_key: Block) Block {
return Block{
.repr = asm (
\\ vaesenclast %[rk], %[in], %[out]
@ -60,7 +60,7 @@ pub const Block = struct {
}
/// Decrypt a block with a round key.
pub fn decrypt(block: Block, inv_round_key: Block) callconv(.Inline) Block {
pub inline fn decrypt(block: Block, inv_round_key: Block) Block {
return Block{
.repr = asm (
\\ vaesdec %[rk], %[in], %[out]
@ -72,7 +72,7 @@ pub const Block = struct {
}
/// Decrypt a block with the last round key.
pub fn decryptLast(block: Block, inv_round_key: Block) callconv(.Inline) Block {
pub inline fn decryptLast(block: Block, inv_round_key: Block) Block {
return Block{
.repr = asm (
\\ vaesdeclast %[rk], %[in], %[out]
@ -84,17 +84,17 @@ pub const Block = struct {
}
/// Apply the bitwise XOR operation to the content of two blocks.
pub fn xorBlocks(block1: Block, block2: Block) callconv(.Inline) Block {
pub inline fn xorBlocks(block1: Block, block2: Block) Block {
return Block{ .repr = block1.repr ^ block2.repr };
}
/// Apply the bitwise AND operation to the content of two blocks.
pub fn andBlocks(block1: Block, block2: Block) callconv(.Inline) Block {
pub inline fn andBlocks(block1: Block, block2: Block) Block {
return Block{ .repr = block1.repr & block2.repr };
}
/// Apply the bitwise OR operation to the content of two blocks.
pub fn orBlocks(block1: Block, block2: Block) callconv(.Inline) Block {
pub inline fn orBlocks(block1: Block, block2: Block) Block {
return Block{ .repr = block1.repr | block2.repr };
}
@ -114,7 +114,7 @@ pub const Block = struct {
};
/// Encrypt multiple blocks in parallel, each their own round key.
pub fn encryptParallel(comptime count: usize, blocks: [count]Block, round_keys: [count]Block) callconv(.Inline) [count]Block {
pub inline fn encryptParallel(comptime count: usize, blocks: [count]Block, round_keys: [count]Block) [count]Block {
comptime var i = 0;
var out: [count]Block = undefined;
inline while (i < count) : (i += 1) {
@ -124,7 +124,7 @@ pub const Block = struct {
}
/// Decrypt multiple blocks in parallel, each their own round key.
pub fn decryptParallel(comptime count: usize, blocks: [count]Block, round_keys: [count]Block) callconv(.Inline) [count]Block {
pub inline fn decryptParallel(comptime count: usize, blocks: [count]Block, round_keys: [count]Block) [count]Block {
comptime var i = 0;
var out: [count]Block = undefined;
inline while (i < count) : (i += 1) {
@ -134,7 +134,7 @@ pub const Block = struct {
}
/// Encrypt multiple blocks in parallel with the same round key.
pub fn encryptWide(comptime count: usize, blocks: [count]Block, round_key: Block) callconv(.Inline) [count]Block {
pub inline fn encryptWide(comptime count: usize, blocks: [count]Block, round_key: Block) [count]Block {
comptime var i = 0;
var out: [count]Block = undefined;
inline while (i < count) : (i += 1) {
@ -144,7 +144,7 @@ pub const Block = struct {
}
/// Decrypt multiple blocks in parallel with the same round key.
pub fn decryptWide(comptime count: usize, blocks: [count]Block, round_key: Block) callconv(.Inline) [count]Block {
pub inline fn decryptWide(comptime count: usize, blocks: [count]Block, round_key: Block) [count]Block {
comptime var i = 0;
var out: [count]Block = undefined;
inline while (i < count) : (i += 1) {
@ -154,7 +154,7 @@ pub const Block = struct {
}
/// Encrypt multiple blocks in parallel with the same last round key.
pub fn encryptLastWide(comptime count: usize, blocks: [count]Block, round_key: Block) callconv(.Inline) [count]Block {
pub inline fn encryptLastWide(comptime count: usize, blocks: [count]Block, round_key: Block) [count]Block {
comptime var i = 0;
var out: [count]Block = undefined;
inline while (i < count) : (i += 1) {
@ -164,7 +164,7 @@ pub const Block = struct {
}
/// Decrypt multiple blocks in parallel with the same last round key.
pub fn decryptLastWide(comptime count: usize, blocks: [count]Block, round_key: Block) callconv(.Inline) [count]Block {
pub inline fn decryptLastWide(comptime count: usize, blocks: [count]Block, round_key: Block) [count]Block {
comptime var i = 0;
var out: [count]Block = undefined;
inline while (i < count) : (i += 1) {

View File

@ -19,18 +19,18 @@ pub const Block = struct {
repr: BlockVec,
/// Convert a byte sequence into an internal representation.
pub fn fromBytes(bytes: *const [16]u8) callconv(.Inline) Block {
pub inline fn fromBytes(bytes: *const [16]u8) Block {
const repr = mem.bytesToValue(BlockVec, bytes);
return Block{ .repr = repr };
}
/// Convert the internal representation of a block into a byte sequence.
pub fn toBytes(block: Block) callconv(.Inline) [16]u8 {
pub inline fn toBytes(block: Block) [16]u8 {
return mem.toBytes(block.repr);
}
/// XOR the block with a byte sequence.
pub fn xorBytes(block: Block, bytes: *const [16]u8) callconv(.Inline) [16]u8 {
pub inline fn xorBytes(block: Block, bytes: *const [16]u8) [16]u8 {
const x = block.repr ^ fromBytes(bytes).repr;
return mem.toBytes(x);
}
@ -38,7 +38,7 @@ pub const Block = struct {
const zero = Vector(2, u64){ 0, 0 };
/// Encrypt a block with a round key.
pub fn encrypt(block: Block, round_key: Block) callconv(.Inline) Block {
pub inline fn encrypt(block: Block, round_key: Block) Block {
return Block{
.repr = asm (
\\ mov %[out].16b, %[in].16b
@ -54,7 +54,7 @@ pub const Block = struct {
}
/// Encrypt a block with the last round key.
pub fn encryptLast(block: Block, round_key: Block) callconv(.Inline) Block {
pub inline fn encryptLast(block: Block, round_key: Block) Block {
return Block{
.repr = asm (
\\ mov %[out].16b, %[in].16b
@ -69,7 +69,7 @@ pub const Block = struct {
}
/// Decrypt a block with a round key.
pub fn decrypt(block: Block, inv_round_key: Block) callconv(.Inline) Block {
pub inline fn decrypt(block: Block, inv_round_key: Block) Block {
return Block{
.repr = asm (
\\ mov %[out].16b, %[in].16b
@ -85,7 +85,7 @@ pub const Block = struct {
}
/// Decrypt a block with the last round key.
pub fn decryptLast(block: Block, inv_round_key: Block) callconv(.Inline) Block {
pub inline fn decryptLast(block: Block, inv_round_key: Block) Block {
return Block{
.repr = asm (
\\ mov %[out].16b, %[in].16b
@ -100,17 +100,17 @@ pub const Block = struct {
}
/// Apply the bitwise XOR operation to the content of two blocks.
pub fn xorBlocks(block1: Block, block2: Block) callconv(.Inline) Block {
pub inline fn xorBlocks(block1: Block, block2: Block) Block {
return Block{ .repr = block1.repr ^ block2.repr };
}
/// Apply the bitwise AND operation to the content of two blocks.
pub fn andBlocks(block1: Block, block2: Block) callconv(.Inline) Block {
pub inline fn andBlocks(block1: Block, block2: Block) Block {
return Block{ .repr = block1.repr & block2.repr };
}
/// Apply the bitwise OR operation to the content of two blocks.
pub fn orBlocks(block1: Block, block2: Block) callconv(.Inline) Block {
pub inline fn orBlocks(block1: Block, block2: Block) Block {
return Block{ .repr = block1.repr | block2.repr };
}
@ -120,7 +120,7 @@ pub const Block = struct {
pub const optimal_parallel_blocks = 8;
/// Encrypt multiple blocks in parallel, each their own round key.
pub fn encryptParallel(comptime count: usize, blocks: [count]Block, round_keys: [count]Block) callconv(.Inline) [count]Block {
pub inline fn encryptParallel(comptime count: usize, blocks: [count]Block, round_keys: [count]Block) [count]Block {
comptime var i = 0;
var out: [count]Block = undefined;
inline while (i < count) : (i += 1) {
@ -130,7 +130,7 @@ pub const Block = struct {
}
/// Decrypt multiple blocks in parallel, each their own round key.
pub fn decryptParallel(comptime count: usize, blocks: [count]Block, round_keys: [count]Block) callconv(.Inline) [count]Block {
pub inline fn decryptParallel(comptime count: usize, blocks: [count]Block, round_keys: [count]Block) [count]Block {
comptime var i = 0;
var out: [count]Block = undefined;
inline while (i < count) : (i += 1) {
@ -140,7 +140,7 @@ pub const Block = struct {
}
/// Encrypt multiple blocks in parallel with the same round key.
pub fn encryptWide(comptime count: usize, blocks: [count]Block, round_key: Block) callconv(.Inline) [count]Block {
pub inline fn encryptWide(comptime count: usize, blocks: [count]Block, round_key: Block) [count]Block {
comptime var i = 0;
var out: [count]Block = undefined;
inline while (i < count) : (i += 1) {
@ -150,7 +150,7 @@ pub const Block = struct {
}
/// Decrypt multiple blocks in parallel with the same round key.
pub fn decryptWide(comptime count: usize, blocks: [count]Block, round_key: Block) callconv(.Inline) [count]Block {
pub inline fn decryptWide(comptime count: usize, blocks: [count]Block, round_key: Block) [count]Block {
comptime var i = 0;
var out: [count]Block = undefined;
inline while (i < count) : (i += 1) {
@ -160,7 +160,7 @@ pub const Block = struct {
}
/// Encrypt multiple blocks in parallel with the same last round key.
pub fn encryptLastWide(comptime count: usize, blocks: [count]Block, round_key: Block) callconv(.Inline) [count]Block {
pub inline fn encryptLastWide(comptime count: usize, blocks: [count]Block, round_key: Block) [count]Block {
comptime var i = 0;
var out: [count]Block = undefined;
inline while (i < count) : (i += 1) {
@ -170,7 +170,7 @@ pub const Block = struct {
}
/// Decrypt multiple blocks in parallel with the same last round key.
pub fn decryptLastWide(comptime count: usize, blocks: [count]Block, round_key: Block) callconv(.Inline) [count]Block {
pub inline fn decryptLastWide(comptime count: usize, blocks: [count]Block, round_key: Block) [count]Block {
comptime var i = 0;
var out: [count]Block = undefined;
inline while (i < count) : (i += 1) {

View File

@ -18,7 +18,7 @@ pub const Block = struct {
repr: BlockVec align(16),
/// Convert a byte sequence into an internal representation.
pub fn fromBytes(bytes: *const [16]u8) callconv(.Inline) Block {
pub inline fn fromBytes(bytes: *const [16]u8) Block {
const s0 = mem.readIntBig(u32, bytes[0..4]);
const s1 = mem.readIntBig(u32, bytes[4..8]);
const s2 = mem.readIntBig(u32, bytes[8..12]);
@ -27,7 +27,7 @@ pub const Block = struct {
}
/// Convert the internal representation of a block into a byte sequence.
pub fn toBytes(block: Block) callconv(.Inline) [16]u8 {
pub inline fn toBytes(block: Block) [16]u8 {
var bytes: [16]u8 = undefined;
mem.writeIntBig(u32, bytes[0..4], block.repr[0]);
mem.writeIntBig(u32, bytes[4..8], block.repr[1]);
@ -37,7 +37,7 @@ pub const Block = struct {
}
/// XOR the block with a byte sequence.
pub fn xorBytes(block: Block, bytes: *const [16]u8) callconv(.Inline) [16]u8 {
pub inline fn xorBytes(block: Block, bytes: *const [16]u8) [16]u8 {
const block_bytes = block.toBytes();
var x: [16]u8 = undefined;
comptime var i: usize = 0;
@ -48,7 +48,7 @@ pub const Block = struct {
}
/// Encrypt a block with a round key.
pub fn encrypt(block: Block, round_key: Block) callconv(.Inline) Block {
pub inline fn encrypt(block: Block, round_key: Block) Block {
const src = &block.repr;
const s0 = block.repr[0];
@ -65,7 +65,7 @@ pub const Block = struct {
}
/// Encrypt a block with the last round key.
pub fn encryptLast(block: Block, round_key: Block) callconv(.Inline) Block {
pub inline fn encryptLast(block: Block, round_key: Block) Block {
const src = &block.repr;
const t0 = block.repr[0];
@ -87,7 +87,7 @@ pub const Block = struct {
}
/// Decrypt a block with a round key.
pub fn decrypt(block: Block, round_key: Block) callconv(.Inline) Block {
pub inline fn decrypt(block: Block, round_key: Block) Block {
const src = &block.repr;
const s0 = block.repr[0];
@ -104,7 +104,7 @@ pub const Block = struct {
}
/// Decrypt a block with the last round key.
pub fn decryptLast(block: Block, round_key: Block) callconv(.Inline) Block {
pub inline fn decryptLast(block: Block, round_key: Block) Block {
const src = &block.repr;
const t0 = block.repr[0];
@ -126,7 +126,7 @@ pub const Block = struct {
}
/// Apply the bitwise XOR operation to the content of two blocks.
pub fn xorBlocks(block1: Block, block2: Block) callconv(.Inline) Block {
pub inline fn xorBlocks(block1: Block, block2: Block) Block {
var x: BlockVec = undefined;
comptime var i = 0;
inline while (i < 4) : (i += 1) {
@ -136,7 +136,7 @@ pub const Block = struct {
}
/// Apply the bitwise AND operation to the content of two blocks.
pub fn andBlocks(block1: Block, block2: Block) callconv(.Inline) Block {
pub inline fn andBlocks(block1: Block, block2: Block) Block {
var x: BlockVec = undefined;
comptime var i = 0;
inline while (i < 4) : (i += 1) {
@ -146,7 +146,7 @@ pub const Block = struct {
}
/// Apply the bitwise OR operation to the content of two blocks.
pub fn orBlocks(block1: Block, block2: Block) callconv(.Inline) Block {
pub inline fn orBlocks(block1: Block, block2: Block) Block {
var x: BlockVec = undefined;
comptime var i = 0;
inline while (i < 4) : (i += 1) {

View File

@ -33,7 +33,7 @@ fn AesOcb(comptime Aes: anytype) type {
table: [56]Block align(16) = undefined,
upto: usize,
fn double(l: Block) callconv(.Inline) Block {
inline fn double(l: Block) Block {
const l_ = mem.readIntBig(u128, &l);
const l_2 = (l_ << 1) ^ (0x87 & -%(l_ >> 127));
var l2: Block = undefined;
@ -245,7 +245,7 @@ fn AesOcb(comptime Aes: anytype) type {
};
}
fn xorBlocks(x: Block, y: Block) callconv(.Inline) Block {
inline fn xorBlocks(x: Block, y: Block) Block {
var z: Block = x;
for (z) |*v, i| {
v.* = x[i] ^ y[i];
@ -253,7 +253,7 @@ fn xorBlocks(x: Block, y: Block) callconv(.Inline) Block {
return z;
}
fn xorWith(x: *Block, y: Block) callconv(.Inline) void {
inline fn xorWith(x: *Block, y: Block) void {
for (x) |*v, i| {
v.* ^= y[i];
}

View File

@ -66,7 +66,7 @@ const CompressVectorized = struct {
const Lane = Vector(4, u32);
const Rows = [4]Lane;
fn g(comptime even: bool, rows: *Rows, m: Lane) callconv(.Inline) void {
inline fn g(comptime even: bool, rows: *Rows, m: Lane) void {
rows[0] +%= rows[1] +% m;
rows[3] ^= rows[0];
rows[3] = math.rotr(Lane, rows[3], if (even) 8 else 16);
@ -75,13 +75,13 @@ const CompressVectorized = struct {
rows[1] = math.rotr(Lane, rows[1], if (even) 7 else 12);
}
fn diagonalize(rows: *Rows) callconv(.Inline) void {
inline fn diagonalize(rows: *Rows) void {
rows[0] = @shuffle(u32, rows[0], undefined, [_]i32{ 3, 0, 1, 2 });
rows[3] = @shuffle(u32, rows[3], undefined, [_]i32{ 2, 3, 0, 1 });
rows[2] = @shuffle(u32, rows[2], undefined, [_]i32{ 1, 2, 3, 0 });
}
fn undiagonalize(rows: *Rows) callconv(.Inline) void {
inline fn undiagonalize(rows: *Rows) void {
rows[0] = @shuffle(u32, rows[0], undefined, [_]i32{ 1, 2, 3, 0 });
rows[3] = @shuffle(u32, rows[3], undefined, [_]i32{ 2, 3, 0, 1 });
rows[2] = @shuffle(u32, rows[2], undefined, [_]i32{ 3, 0, 1, 2 });

View File

@ -102,7 +102,7 @@ fn ChaChaVecImpl(comptime rounds_nb: usize) type {
};
}
fn chacha20Core(x: *BlockVec, input: BlockVec) callconv(.Inline) void {
inline fn chacha20Core(x: *BlockVec, input: BlockVec) void {
x.* = input;
var r: usize = 0;
@ -147,7 +147,7 @@ fn ChaChaVecImpl(comptime rounds_nb: usize) type {
}
}
fn hashToBytes(out: *[64]u8, x: BlockVec) callconv(.Inline) void {
inline fn hashToBytes(out: *[64]u8, x: BlockVec) void {
var i: usize = 0;
while (i < 4) : (i += 1) {
mem.writeIntLittle(u32, out[16 * i + 0 ..][0..4], x[i][0]);
@ -157,7 +157,7 @@ fn ChaChaVecImpl(comptime rounds_nb: usize) type {
}
}
fn contextFeedback(x: *BlockVec, ctx: BlockVec) callconv(.Inline) void {
inline fn contextFeedback(x: *BlockVec, ctx: BlockVec) void {
x[0] +%= ctx[0];
x[1] +%= ctx[1];
x[2] +%= ctx[2];
@ -259,7 +259,7 @@ fn ChaChaNonVecImpl(comptime rounds_nb: usize) type {
};
}
fn chacha20Core(x: *BlockVec, input: BlockVec) callconv(.Inline) void {
inline fn chacha20Core(x: *BlockVec, input: BlockVec) void {
x.* = input;
const rounds = comptime [_]QuarterRound{
@ -288,7 +288,7 @@ fn ChaChaNonVecImpl(comptime rounds_nb: usize) type {
}
}
fn hashToBytes(out: *[64]u8, x: BlockVec) callconv(.Inline) void {
inline fn hashToBytes(out: *[64]u8, x: BlockVec) void {
var i: usize = 0;
while (i < 4) : (i += 1) {
mem.writeIntLittle(u32, out[16 * i + 0 ..][0..4], x[i * 4 + 0]);
@ -298,7 +298,7 @@ fn ChaChaNonVecImpl(comptime rounds_nb: usize) type {
}
}
fn contextFeedback(x: *BlockVec, ctx: BlockVec) callconv(.Inline) void {
inline fn contextFeedback(x: *BlockVec, ctx: BlockVec) void {
var i: usize = 0;
while (i < 16) : (i += 1) {
x[i] +%= ctx[i];

View File

@ -95,7 +95,7 @@ pub const Ghash = struct {
}
}
fn clmul_pclmul(x: u64, y: u64) callconv(.Inline) u64 {
inline fn clmul_pclmul(x: u64, y: u64) u64 {
const Vector = std.meta.Vector;
const product = asm (
\\ vpclmulqdq $0x00, %[x], %[y], %[out]
@ -106,7 +106,7 @@ pub const Ghash = struct {
return product[0];
}
fn clmul_pmull(x: u64, y: u64) callconv(.Inline) u64 {
inline fn clmul_pmull(x: u64, y: u64) u64 {
const Vector = std.meta.Vector;
const product = asm (
\\ pmull %[out].1q, %[x].1d, %[y].1d

View File

@ -49,7 +49,7 @@ pub const State = struct {
return mem.asBytes(&self.data);
}
fn endianSwap(self: *Self) callconv(.Inline) void {
inline fn endianSwap(self: *Self) void {
for (self.data) |*w| {
w.* = mem.littleToNative(u32, w.*);
}
@ -117,7 +117,7 @@ pub const State = struct {
const Lane = Vector(4, u32);
fn shift(x: Lane, comptime n: comptime_int) callconv(.Inline) Lane {
inline fn shift(x: Lane, comptime n: comptime_int) Lane {
return x << @splat(4, @as(u5, n));
}

View File

@ -35,7 +35,7 @@ pub const Limbs = [4]u64;
/// Output Bounds:
/// out1: [0x0 ~> 0xffffffffffffffff]
/// out2: [0x0 ~> 0x1]
fn addcarryxU64(out1: *u64, out2: *u1, arg1: u1, arg2: u64, arg3: u64) callconv(.Inline) void {
inline fn addcarryxU64(out1: *u64, out2: *u1, arg1: u1, arg2: u64, arg3: u64) void {
@setRuntimeSafety(mode == .Debug);
var t: u64 = undefined;
@ -56,7 +56,7 @@ fn addcarryxU64(out1: *u64, out2: *u1, arg1: u1, arg2: u64, arg3: u64) callconv(
/// Output Bounds:
/// out1: [0x0 ~> 0xffffffffffffffff]
/// out2: [0x0 ~> 0x1]
fn subborrowxU64(out1: *u64, out2: *u1, arg1: u1, arg2: u64, arg3: u64) callconv(.Inline) void {
inline fn subborrowxU64(out1: *u64, out2: *u1, arg1: u1, arg2: u64, arg3: u64) void {
@setRuntimeSafety(mode == .Debug);
var t: u64 = undefined;
@ -76,7 +76,7 @@ fn subborrowxU64(out1: *u64, out2: *u1, arg1: u1, arg2: u64, arg3: u64) callconv
/// Output Bounds:
/// out1: [0x0 ~> 0xffffffffffffffff]
/// out2: [0x0 ~> 0xffffffffffffffff]
fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) callconv(.Inline) void {
inline fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void {
@setRuntimeSafety(mode == .Debug);
const x = @as(u128, arg1) * @as(u128, arg2);
@ -94,7 +94,7 @@ fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) callconv(.Inline) void
/// arg3: [0x0 ~> 0xffffffffffffffff]
/// Output Bounds:
/// out1: [0x0 ~> 0xffffffffffffffff]
fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) callconv(.Inline) void {
inline fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void {
@setRuntimeSafety(mode == .Debug);
const mask = 0 -% @as(u64, arg1);

View File

@ -35,7 +35,7 @@ pub const Limbs = [4]u64;
/// Output Bounds:
/// out1: [0x0 ~> 0xffffffffffffffff]
/// out2: [0x0 ~> 0x1]
fn addcarryxU64(out1: *u64, out2: *u1, arg1: u1, arg2: u64, arg3: u64) callconv(.Inline) void {
inline fn addcarryxU64(out1: *u64, out2: *u1, arg1: u1, arg2: u64, arg3: u64) void {
@setRuntimeSafety(mode == .Debug);
var t: u64 = undefined;
@ -56,7 +56,7 @@ fn addcarryxU64(out1: *u64, out2: *u1, arg1: u1, arg2: u64, arg3: u64) callconv(
/// Output Bounds:
/// out1: [0x0 ~> 0xffffffffffffffff]
/// out2: [0x0 ~> 0x1]
fn subborrowxU64(out1: *u64, out2: *u1, arg1: u1, arg2: u64, arg3: u64) callconv(.Inline) void {
inline fn subborrowxU64(out1: *u64, out2: *u1, arg1: u1, arg2: u64, arg3: u64) void {
@setRuntimeSafety(mode == .Debug);
var t: u64 = undefined;
@ -76,7 +76,7 @@ fn subborrowxU64(out1: *u64, out2: *u1, arg1: u1, arg2: u64, arg3: u64) callconv
/// Output Bounds:
/// out1: [0x0 ~> 0xffffffffffffffff]
/// out2: [0x0 ~> 0xffffffffffffffff]
fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) callconv(.Inline) void {
inline fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void {
@setRuntimeSafety(mode == .Debug);
const x = @as(u128, arg1) * @as(u128, arg2);
@ -94,7 +94,7 @@ fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) callconv(.Inline) void
/// arg3: [0x0 ~> 0xffffffffffffffff]
/// Output Bounds:
/// out1: [0x0 ~> 0xffffffffffffffff]
fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) callconv(.Inline) void {
inline fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void {
@setRuntimeSafety(mode == .Debug);
const mask = 0 -% @as(u64, arg1);

View File

@ -41,7 +41,7 @@ const Salsa20VecImpl = struct {
};
}
fn salsa20Core(x: *BlockVec, input: BlockVec, comptime feedback: bool) callconv(.Inline) void {
inline fn salsa20Core(x: *BlockVec, input: BlockVec, comptime feedback: bool) void {
const n1n2n3n0 = Lane{ input[3][1], input[3][2], input[3][3], input[3][0] };
const n1n2 = Half{ n1n2n3n0[0], n1n2n3n0[1] };
const n3n0 = Half{ n1n2n3n0[2], n1n2n3n0[3] };
@ -215,7 +215,7 @@ const Salsa20NonVecImpl = struct {
d: u6,
};
fn Rp(a: usize, b: usize, c: usize, d: u6) callconv(.Inline) QuarterRound {
inline fn Rp(a: usize, b: usize, c: usize, d: u6) QuarterRound {
return QuarterRound{
.a = a,
.b = b,
@ -224,7 +224,7 @@ const Salsa20NonVecImpl = struct {
};
}
fn salsa20Core(x: *BlockVec, input: BlockVec, comptime feedback: bool) callconv(.Inline) void {
inline fn salsa20Core(x: *BlockVec, input: BlockVec, comptime feedback: bool) void {
const arx_steps = comptime [_]QuarterRound{
Rp(4, 0, 12, 7), Rp(8, 4, 0, 9), Rp(12, 8, 4, 13), Rp(0, 12, 8, 18),
Rp(9, 5, 1, 7), Rp(13, 9, 5, 9), Rp(1, 13, 9, 13), Rp(5, 1, 13, 18),

View File

@ -721,10 +721,10 @@ pub const Elf32_Rel = extern struct {
r_offset: Elf32_Addr,
r_info: Elf32_Word,
pub fn r_sym(self: @This()) callconv(.Inline) u24 {
pub inline fn r_sym(self: @This()) u24 {
return @truncate(u24, self.r_info >> 8);
}
pub fn r_type(self: @This()) callconv(.Inline) u8 {
pub inline fn r_type(self: @This()) u8 {
return @truncate(u8, self.r_info & 0xff);
}
};
@ -732,10 +732,10 @@ pub const Elf64_Rel = extern struct {
r_offset: Elf64_Addr,
r_info: Elf64_Xword,
pub fn r_sym(self: @This()) callconv(.Inline) u32 {
pub inline fn r_sym(self: @This()) u32 {
return @truncate(u32, self.r_info >> 32);
}
pub fn r_type(self: @This()) callconv(.Inline) u32 {
pub inline fn r_type(self: @This()) u32 {
return @truncate(u32, self.r_info & 0xffffffff);
}
};
@ -744,10 +744,10 @@ pub const Elf32_Rela = extern struct {
r_info: Elf32_Word,
r_addend: Elf32_Sword,
pub fn r_sym(self: @This()) callconv(.Inline) u24 {
pub inline fn r_sym(self: @This()) u24 {
return @truncate(u24, self.r_info >> 8);
}
pub fn r_type(self: @This()) callconv(.Inline) u8 {
pub inline fn r_type(self: @This()) u8 {
return @truncate(u8, self.r_info & 0xff);
}
};
@ -756,10 +756,10 @@ pub const Elf64_Rela = extern struct {
r_info: Elf64_Xword,
r_addend: Elf64_Sxword,
pub fn r_sym(self: @This()) callconv(.Inline) u32 {
pub inline fn r_sym(self: @This()) u32 {
return @truncate(u32, self.r_info >> 32);
}
pub fn r_type(self: @This()) callconv(.Inline) u32 {
pub inline fn r_type(self: @This()) u32 {
return @truncate(u32, self.r_info & 0xffffffff);
}
};

View File

@ -52,21 +52,21 @@ const Z96 = struct {
d2: u32,
// d = s >> 1
fn shiftRight1(d: *Z96, s: Z96) callconv(.Inline) void {
inline fn shiftRight1(d: *Z96, s: Z96) void {
d.d0 = (s.d0 >> 1) | ((s.d1 & 1) << 31);
d.d1 = (s.d1 >> 1) | ((s.d2 & 1) << 31);
d.d2 = s.d2 >> 1;
}
// d = s << 1
fn shiftLeft1(d: *Z96, s: Z96) callconv(.Inline) void {
inline fn shiftLeft1(d: *Z96, s: Z96) void {
d.d2 = (s.d2 << 1) | ((s.d1 & (1 << 31)) >> 31);
d.d1 = (s.d1 << 1) | ((s.d0 & (1 << 31)) >> 31);
d.d0 = s.d0 << 1;
}
// d += s
fn add(d: *Z96, s: Z96) callconv(.Inline) void {
inline fn add(d: *Z96, s: Z96) void {
var w = @as(u64, d.d0) + @as(u64, s.d0);
d.d0 = @truncate(u32, w);
@ -80,7 +80,7 @@ const Z96 = struct {
}
// d -= s
fn sub(d: *Z96, s: Z96) callconv(.Inline) void {
inline fn sub(d: *Z96, s: Z96) void {
var w = @as(u64, d.d0) -% @as(u64, s.d0);
d.d0 = @truncate(u32, w);

View File

@ -6,7 +6,7 @@
const std = @import("std");
const builtin = std.builtin;
fn offsetPtr(ptr: [*]const u8, offset: usize) callconv(.Inline) [*]const u8 {
inline fn offsetPtr(ptr: [*]const u8, offset: usize) [*]const u8 {
// ptr + offset doesn't work at comptime so we need this instead.
return @ptrCast([*]const u8, &ptr[offset]);
}

View File

@ -2014,12 +2014,9 @@ test "parse into struct with duplicate field" {
const ballast = try testing.allocator.alloc(u64, 1);
defer testing.allocator.free(ballast);
const options_first = ParseOptions{
.allocator = testing.allocator,
.duplicate_field_behavior = .UseFirst
};
const options_first = ParseOptions{ .allocator = testing.allocator, .duplicate_field_behavior = .UseFirst };
const options_last = ParseOptions{
const options_last = ParseOptions{
.allocator = testing.allocator,
.duplicate_field_behavior = .UseLast,
};

View File

@ -1334,7 +1334,7 @@ test "math.comptime" {
/// Returns a mask of all ones if value is true,
/// and a mask of all zeroes if value is false.
/// Compiles to one instruction for register sized integers.
pub fn boolMask(comptime MaskInt: type, value: bool) callconv(.Inline) MaskInt {
pub inline fn boolMask(comptime MaskInt: type, value: bool) MaskInt {
if (@typeInfo(MaskInt) != .Int)
@compileError("boolMask requires an integer mask type.");

View File

@ -38,7 +38,7 @@ pub fn Complex(comptime T: type) type {
/// Imaginary part.
im: T,
/// Deprecated, use init()
pub const new = init;

View File

@ -823,16 +823,16 @@ pub const sigval = extern union {
pub const _SIG_WORDS = 4;
pub const _SIG_MAXSIG = 128;
pub fn _SIG_IDX(sig: usize) callconv(.Inline) usize {
pub inline fn _SIG_IDX(sig: usize) usize {
return sig - 1;
}
pub fn _SIG_WORD(sig: usize) callconv(.Inline) usize {
pub inline fn _SIG_WORD(sig: usize) usize {
return_SIG_IDX(sig) >> 5;
}
pub fn _SIG_BIT(sig: usize) callconv(.Inline) usize {
pub inline fn _SIG_BIT(sig: usize) usize {
return 1 << (_SIG_IDX(sig) & 31);
}
pub fn _SIG_VALID(sig: usize) callconv(.Inline) usize {
pub inline fn _SIG_VALID(sig: usize) usize {
return sig <= _SIG_MAXSIG and sig > 0;
}

View File

@ -721,16 +721,16 @@ pub const Sigaction = extern struct {
pub const _SIG_WORDS = 4;
pub const _SIG_MAXSIG = 128;
pub fn _SIG_IDX(sig: usize) callconv(.Inline) usize {
pub inline fn _SIG_IDX(sig: usize) usize {
return sig - 1;
}
pub fn _SIG_WORD(sig: usize) callconv(.Inline) usize {
pub inline fn _SIG_WORD(sig: usize) usize {
return_SIG_IDX(sig) >> 5;
}
pub fn _SIG_BIT(sig: usize) callconv(.Inline) usize {
pub inline fn _SIG_BIT(sig: usize) usize {
return 1 << (_SIG_IDX(sig) & 31);
}
pub fn _SIG_VALID(sig: usize) callconv(.Inline) usize {
pub inline fn _SIG_VALID(sig: usize) usize {
return sig <= _SIG_MAXSIG and sig > 0;
}

View File

@ -804,16 +804,16 @@ pub const _ksiginfo = extern struct {
pub const _SIG_WORDS = 4;
pub const _SIG_MAXSIG = 128;
pub fn _SIG_IDX(sig: usize) callconv(.Inline) usize {
pub inline fn _SIG_IDX(sig: usize) usize {
return sig - 1;
}
pub fn _SIG_WORD(sig: usize) callconv(.Inline) usize {
pub inline fn _SIG_WORD(sig: usize) usize {
return_SIG_IDX(sig) >> 5;
}
pub fn _SIG_BIT(sig: usize) callconv(.Inline) usize {
pub inline fn _SIG_BIT(sig: usize) usize {
return 1 << (_SIG_IDX(sig) & 31);
}
pub fn _SIG_VALID(sig: usize) callconv(.Inline) usize {
pub inline fn _SIG_VALID(sig: usize) usize {
return sig <= _SIG_MAXSIG and sig > 0;
}

View File

@ -145,7 +145,7 @@ pub fn fork() usize {
/// It is advised to avoid this function and use clone instead, because
/// the compiler is not aware of how vfork affects control flow and you may
/// see different results in optimized builds.
pub fn vfork() callconv(.Inline) usize {
pub inline fn vfork() usize {
return @call(.{ .modifier = .always_inline }, syscall0, .{.vfork});
}

View File

@ -307,7 +307,7 @@ fn initTLS() void {
};
}
fn alignPtrCast(comptime T: type, ptr: [*]u8) callconv(.Inline) *T {
inline fn alignPtrCast(comptime T: type, ptr: [*]u8) *T {
return @ptrCast(*T, @alignCast(@alignOf(T), ptr));
}

View File

@ -1745,7 +1745,7 @@ pub fn wToPrefixedFileW(s: []const u16) !PathSpace {
return path_space;
}
fn MAKELANGID(p: c_ushort, s: c_ushort) callconv(.Inline) LANGID {
inline fn MAKELANGID(p: c_ushort, s: c_ushort) LANGID {
return (s << 10) | p;
}

View File

@ -375,7 +375,7 @@ const bad_main_ret = "expected return type of main to be 'void', '!void', 'noret
// This is marked inline because for some reason LLVM in release mode fails to inline it,
// and we want fewer call frames in stack traces.
fn initEventLoopAndCallMain() callconv(.Inline) u8 {
inline fn initEventLoopAndCallMain() u8 {
if (std.event.Loop.instance) |loop| {
if (!@hasDecl(root, "event_loop")) {
loop.init() catch |err| {
@ -404,7 +404,7 @@ fn initEventLoopAndCallMain() callconv(.Inline) u8 {
// and we want fewer call frames in stack traces.
// TODO This function is duplicated from initEventLoopAndCallMain instead of using generics
// because it is working around stage1 compiler bugs.
fn initEventLoopAndCallWinMain() callconv(.Inline) std.os.windows.INT {
inline fn initEventLoopAndCallWinMain() std.os.windows.INT {
if (std.event.Loop.instance) |loop| {
if (!@hasDecl(root, "event_loop")) {
loop.init() catch |err| {

View File

@ -732,8 +732,7 @@ pub const all_features = blk: {
result[@enumToInt(Feature.Matrix)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability Matrix",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.Shader)] = .{
.llvm_name = null,
@ -759,20 +758,17 @@ pub const all_features = blk: {
result[@enumToInt(Feature.Addresses)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability Addresses",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.Linkage)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability Linkage",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.Kernel)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability Kernel",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.Vector16)] = .{
.llvm_name = null,
@ -791,20 +787,17 @@ pub const all_features = blk: {
result[@enumToInt(Feature.Float16)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability Float16",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.Float64)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability Float64",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.Int64)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability Int64",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.Int64Atomics)] = .{
.llvm_name = null,
@ -844,8 +837,7 @@ pub const all_features = blk: {
result[@enumToInt(Feature.Groups)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability Groups",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.DeviceEnqueue)] = .{
.llvm_name = null,
@ -871,8 +863,7 @@ pub const all_features = blk: {
result[@enumToInt(Feature.Int16)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability Int16",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.TessellationPointSize)] = .{
.llvm_name = null,
@ -982,8 +973,7 @@ pub const all_features = blk: {
result[@enumToInt(Feature.Int8)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability Int8",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.InputAttachment)] = .{
.llvm_name = null,
@ -1009,8 +999,7 @@ pub const all_features = blk: {
result[@enumToInt(Feature.Sampled1D)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability Sampled1D",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.Image1D)] = .{
.llvm_name = null,
@ -1029,8 +1018,7 @@ pub const all_features = blk: {
result[@enumToInt(Feature.SampledBuffer)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability SampledBuffer",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.ImageBuffer)] = .{
.llvm_name = null,
@ -1220,8 +1208,7 @@ pub const all_features = blk: {
result[@enumToInt(Feature.SubgroupBallotKHR)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability SubgroupBallotKHR",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.DrawParameters)] = .{
.llvm_name = null,
@ -1255,8 +1242,7 @@ pub const all_features = blk: {
result[@enumToInt(Feature.SubgroupVoteKHR)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability SubgroupVoteKHR",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.StorageBuffer16BitAccess)] = .{
.llvm_name = null,
@ -1338,14 +1324,12 @@ pub const all_features = blk: {
result[@enumToInt(Feature.AtomicStorageOps)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability AtomicStorageOps",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.SampleMaskPostDepthCoverage)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability SampleMaskPostDepthCoverage",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.StorageBuffer8BitAccess)] = .{
.llvm_name = null,
@ -1548,20 +1532,17 @@ pub const all_features = blk: {
result[@enumToInt(Feature.ImageFootprintNV)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability ImageFootprintNV",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.FragmentBarycentricNV)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability FragmentBarycentricNV",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.ComputeDerivativeGroupQuadsNV)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability ComputeDerivativeGroupQuadsNV",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.FragmentDensityEXT)] = .{
.llvm_name = null,
@ -1580,8 +1561,7 @@ pub const all_features = blk: {
result[@enumToInt(Feature.GroupNonUniformPartitionedNV)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability GroupNonUniformPartitionedNV",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.ShaderNonUniform)] = .{
.llvm_name = null,
@ -1835,8 +1815,7 @@ pub const all_features = blk: {
result[@enumToInt(Feature.ComputeDerivativeGroupLinearNV)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability ComputeDerivativeGroupLinearNV",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.RayTracingProvisionalKHR)] = .{
.llvm_name = null,
@ -1890,38 +1869,32 @@ pub const all_features = blk: {
result[@enumToInt(Feature.SubgroupShuffleINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability SubgroupShuffleINTEL",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.SubgroupBufferBlockIOINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability SubgroupBufferBlockIOINTEL",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.SubgroupImageBlockIOINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability SubgroupImageBlockIOINTEL",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.SubgroupImageMediaBlockIOINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability SubgroupImageMediaBlockIOINTEL",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.RoundToInfinityINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability RoundToInfinityINTEL",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.FloatingPointModeINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability FloatingPointModeINTEL",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.IntegerFunctions2INTEL)] = .{
.llvm_name = null,
@ -1933,38 +1906,32 @@ pub const all_features = blk: {
result[@enumToInt(Feature.FunctionPointersINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability FunctionPointersINTEL",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.IndirectReferencesINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability IndirectReferencesINTEL",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.AsmINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability AsmINTEL",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.AtomicFloat32MinMaxEXT)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability AtomicFloat32MinMaxEXT",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.AtomicFloat64MinMaxEXT)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability AtomicFloat64MinMaxEXT",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.AtomicFloat16MinMaxEXT)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability AtomicFloat16MinMaxEXT",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.VectorComputeINTEL)] = .{
.llvm_name = null,
@ -1976,50 +1943,42 @@ pub const all_features = blk: {
result[@enumToInt(Feature.VectorAnyINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability VectorAnyINTEL",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.ExpectAssumeKHR)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability ExpectAssumeKHR",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.SubgroupAvcMotionEstimationINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability SubgroupAvcMotionEstimationINTEL",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.SubgroupAvcMotionEstimationIntraINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability SubgroupAvcMotionEstimationIntraINTEL",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.SubgroupAvcMotionEstimationChromaINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability SubgroupAvcMotionEstimationChromaINTEL",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.VariableLengthArrayINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability VariableLengthArrayINTEL",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.FunctionFloatControlINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability FunctionFloatControlINTEL",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.FPGAMemoryAttributesINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability FPGAMemoryAttributesINTEL",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.FPFastMathModeINTEL)] = .{
.llvm_name = null,
@ -2031,80 +1990,67 @@ pub const all_features = blk: {
result[@enumToInt(Feature.ArbitraryPrecisionIntegersINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability ArbitraryPrecisionIntegersINTEL",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.UnstructuredLoopControlsINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability UnstructuredLoopControlsINTEL",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.FPGALoopControlsINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability FPGALoopControlsINTEL",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.KernelAttributesINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability KernelAttributesINTEL",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.FPGAKernelAttributesINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability FPGAKernelAttributesINTEL",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.FPGAMemoryAccessesINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability FPGAMemoryAccessesINTEL",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.FPGAClusterAttributesINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability FPGAClusterAttributesINTEL",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.LoopFuseINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability LoopFuseINTEL",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.FPGABufferLocationINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability FPGABufferLocationINTEL",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.USMStorageClassesINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability USMStorageClassesINTEL",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.IOPipesINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability IOPipesINTEL",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.BlockingPipesINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability BlockingPipesINTEL",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.FPGARegINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability FPGARegINTEL",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.AtomicFloat32AddEXT)] = .{
.llvm_name = null,
@ -2123,8 +2069,7 @@ pub const all_features = blk: {
result[@enumToInt(Feature.LongConstantCompositeINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability LongConstantCompositeINTEL",
.dependencies = featureSet(&[_]Feature{
}),
.dependencies = featureSet(&[_]Feature{}),
};
const ti = @typeInfo(Feature);
for (result) |*elem, i| {

View File

@ -19,11 +19,11 @@ fn setFeature(cpu: *Target.Cpu, feature: Target.x86.Feature, enabled: bool) void
if (enabled) cpu.features.addFeature(idx) else cpu.features.removeFeature(idx);
}
fn bit(input: u32, offset: u5) callconv(.Inline) bool {
inline fn bit(input: u32, offset: u5) bool {
return (input >> offset) & 1 != 0;
}
fn hasMask(input: u32, mask: u32) callconv(.Inline) bool {
inline fn hasMask(input: u32, mask: u32) bool {
return (input & mask) == mask;
}

View File

@ -275,10 +275,7 @@ fn errorIllegalChar(comptime id: std.meta.Tag(Token), index: usize, char: u8) To
}
fn finishTarget(must_resolve: bool, bytes: []const u8) Token {
return if (must_resolve)
.{ .target_must_resolve = bytes }
else
.{ .target = bytes };
return if (must_resolve) .{ .target_must_resolve = bytes } else .{ .target = bytes };
}
const State = enum {

View File

@ -286,8 +286,7 @@ pub const LibCInstallation = struct {
else if (is_haiku)
"posix/errno.h"
else
"sys/errno.h"
;
"sys/errno.h";
var path_i: usize = 0;
while (path_i < search_paths.items.len) : (path_i += 1) {

View File

@ -2514,7 +2514,7 @@ fn allocatedSizeLinkedit(self: *MachO, start: u64) u64 {
return min_pos - start;
}
fn checkForCollision(start: u64, end: u64, off: u64, size: u64) callconv(.Inline) ?u64 {
inline fn checkForCollision(start: u64, end: u64, off: u64, size: u64) ?u64 {
const increased_size = padToIdeal(size);
const test_end = off + increased_size;
if (end > off and start < test_end) {

View File

@ -585,7 +585,7 @@ pub const Parser = struct {
}
};
fn isArithmeticOp(inst: *const [4]u8) callconv(.Inline) bool {
inline fn isArithmeticOp(inst: *const [4]u8) bool {
const group_decode = @truncate(u5, inst[3]);
return ((group_decode >> 2) == 4);
}

View File

@ -31,7 +31,7 @@ pub const Ctx = if (enable) ___tracy_c_zone_context else struct {
pub fn end(self: Ctx) void {}
};
pub fn trace(comptime src: std.builtin.SourceLocation) callconv(.Inline) Ctx {
pub inline fn trace(comptime src: std.builtin.SourceLocation) Ctx {
if (!enable) return .{};
const loc: ___tracy_source_location_data = .{