zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

extendhfsf2.zig (920B) - Raw


      1 const common = @import("./common.zig");
      2 const extendf = @import("./extendf.zig").extendf;
      3 
      4 pub const panic = common.panic;
      5 
      6 comptime {
      7     if (common.gnu_f16_abi) {
      8         @export(&__gnu_h2f_ieee, .{ .name = "__gnu_h2f_ieee", .linkage = common.linkage, .visibility = common.visibility });
      9     } else if (common.want_aeabi) {
     10         @export(&__aeabi_h2f, .{ .name = "__aeabi_h2f", .linkage = common.linkage, .visibility = common.visibility });
     11     }
     12     @export(&__extendhfsf2, .{ .name = "__extendhfsf2", .linkage = common.linkage, .visibility = common.visibility });
     13 }
     14 
     15 pub fn __extendhfsf2(a: common.F16T(f32)) callconv(.c) f32 {
     16     return extendf(f32, f16, @as(u16, @bitCast(a)));
     17 }
     18 
     19 fn __gnu_h2f_ieee(a: common.F16T(f32)) callconv(.c) f32 {
     20     return extendf(f32, f16, @as(u16, @bitCast(a)));
     21 }
     22 
     23 fn __aeabi_h2f(a: u16) callconv(.{ .arm_aapcs = .{} }) f32 {
     24     return extendf(f32, f16, @as(u16, @bitCast(a)));
     25 }