@@ -9,15 +9,15 @@ const nativeEndian = @import("builtin").cpu.arch.endian();
99const isZig0d14AndLater = builtin .zig_version .order (.{ .major = 0 , .minor = 13 , .patch = 0 }).compare (.gt );
1010
1111pub const mem = struct {
12- pub fn writeIntBig (T : type , dst : * [@divExact (meta .bitsOfType (T ), 8 )]u8 , value : T ) void {
12+ pub inline fn writeIntBig (T : type , dst : * [@divExact (meta .bitsOfType (T ), 8 )]u8 , value : T ) void {
1313 return std .mem .writeInt (T , dst , value , .big );
1414 }
1515
16- pub fn readIntBig (T : type , src : * const [@divExact (meta .bitsOfType (T ), 8 )]u8 ) T {
16+ pub inline fn readIntBig (T : type , src : * const [@divExact (meta .bitsOfType (T ), 8 )]u8 ) T {
1717 return std .mem .readInt (T , src , .big );
1818 }
1919
20- pub fn readFloatBig (comptime T : type , src : * const [@divExact (meta .bitsOfType (T ), 8 )]u8 ) T {
20+ pub inline fn readFloatBig (comptime T : type , src : * const [@divExact (meta .bitsOfType (T ), 8 )]u8 ) T {
2121 if (meta .bitsOfType (T ) > 64 ) {
2222 @compileError ("readFloatBig does not support float types have more than 64 bits." );
2323 }
@@ -35,11 +35,11 @@ pub const mem = struct {
3535 return bytesAsValue (T , src ).* ;
3636 }
3737
38- pub fn writeFloatBig (comptime T : type , dest : * [@divExact (meta .bitsOfType (T ), 8 )]u8 , val : T ) void {
38+ pub inline fn writeFloatBig (comptime T : type , noalias dest : * [@divExact (meta .bitsOfType (T ), 8 )]u8 , noalias val : T ) void {
3939 if (meta .bitsOfType (T ) > 64 ) {
4040 @compileError ("writeFloatBig does not support float types have more than 64 bits." );
4141 }
42- std . mem . copyForwards ( u8 , dest , asBytes (& val ));
42+ @memcpy ( dest , asBytes (& val ));
4343 if (nativeEndian == .little ) {
4444 for (0.. @divExact (dest .len , 2 )) | i | {
4545 std .mem .swap (u8 , & dest [i ], & dest [dest .len - i - 1 ]);
@@ -49,7 +49,7 @@ pub const mem = struct {
4949};
5050
5151pub const math = struct {
52- pub fn absCast (value : anytype ) @TypeOf (@abs (value )) {
52+ pub inline fn absCast (value : anytype ) @TypeOf (@abs (value )) {
5353 return @abs (value );
5454 }
5555};
0 commit comments