feature. See also
. The project being documented here (as the example) is the Zig library itself.
File
Code
const compiler_rt = @import("../compiler_rt.zig");
const comparef = @import("./comparef.zig");
const symbol = @import("../compiler_rt.zig").symbol;
comptime {
if (compiler_rt.want_ppc_abi) {
symbol(&__eqtf2, "__eqkf2");
symbol(&__netf2, "__nekf2");
symbol(&__lttf2, "__ltkf2");
symbol(&__letf2, "__lekf2");
} else if (compiler_rt.want_sparc64_abi) {
symbol(&_Qp_cmp, "_Qp_cmp");
symbol(&_Qp_feq, "_Qp_feq");
symbol(&_Qp_fne, "_Qp_fne");
symbol(&_Qp_flt, "_Qp_flt");
symbol(&_Qp_fle, "_Qp_fle");
symbol(&_Qp_fgt, "_Qp_fgt");
symbol(&_Qp_fge, "_Qp_fge");
} else if (compiler_rt.want_sparc32_abi) {
symbol(&_Q_cmp, "_Q_cmp");
symbol(&_Q_feq, "_Q_feq");
symbol(&_Q_fne, "_Q_fne");
symbol(&_Q_flt, "_Q_flt");
symbol(&_Q_fle, "_Q_fle");
symbol(&_Q_fgt, "_Q_fgt");
symbol(&_Q_fge, "_Q_fge");
}
symbol(&__eqtf2, "__eqtf2");
symbol(&__netf2, "__netf2");
symbol(&__letf2, "__letf2");
symbol(&__cmptf2, "__cmptf2");
symbol(&__lttf2, "__lttf2");
}
fn __cmptf2(a: f128, b: f128) callconv(.c) i32 {
return @backingInt(comparef.cmpf2(f128, comparef.LE, a, b));
}
fn __letf2(a: f128, b: f128) callconv(.c) i32 {
return __cmptf2(a, b);
}
fn __eqtf2(a: f128, b: f128) callconv(.c) i32 {
return __cmptf2(a, b);
}
fn __netf2(a: f128, b: f128) callconv(.c) i32 {
return __cmptf2(a, b);
}
fn __lttf2(a: f128, b: f128) callconv(.c) i32 {
return __cmptf2(a, b);
}
const SparcFCMP = enum(i32) {
Equal = 0,
Less = 1,
Greater = 2,
Unordered = 3,
};
fn _Qp_cmp(a: *const f128, b: *const f128) callconv(.c) i32 {
return @backingInt(comparef.cmpf2(f128, SparcFCMP, a.*, b.*));
}
fn _Qp_feq(a: *const f128, b: *const f128) callconv(.c) bool {
return @as(SparcFCMP, @fromBackingInt(@intCast(_Qp_cmp(a, b)))) == .Equal;
}
fn _Qp_fne(a: *const f128, b: *const f128) callconv(.c) bool {
return @as(SparcFCMP, @fromBackingInt(@intCast(_Qp_cmp(a, b)))) != .Equal;
}
fn _Qp_flt(a: *const f128, b: *const f128) callconv(.c) bool {
return @as(SparcFCMP, @fromBackingInt(@intCast(_Qp_cmp(a, b)))) == .Less;
}
fn _Qp_fgt(a: *const f128, b: *const f128) callconv(.c) bool {
return @as(SparcFCMP, @fromBackingInt(@intCast(_Qp_cmp(a, b)))) == .Greater;
}
fn _Qp_fge(a: *const f128, b: *const f128) callconv(.c) bool {
return switch (@as(SparcFCMP, @fromBackingInt(@intCast(_Qp_cmp(a, b))))) {
.Equal, .Greater => true,
.Less, .Unordered => false,
};
}
fn _Qp_fle(a: *const f128, b: *const f128) callconv(.c) bool {
return switch (@as(SparcFCMP, @fromBackingInt(@intCast(_Qp_cmp(a, b))))) {
.Equal, .Less => true,
.Greater, .Unordered => false,
};
}
fn _Q_cmp(a: f128, b: f128) callconv(.c) i32 {
return @backingInt(comparef.cmpf2(f128, SparcFCMP, a, b));
}
fn _Q_feq(a: f128, b: f128) callconv(.c) bool {
return @as(SparcFCMP, @fromBackingInt(@intCast(_Q_cmp(a, b)))) == .Equal;
}
fn _Q_fne(a: f128, b: f128) callconv(.c) bool {
return @as(SparcFCMP, @fromBackingInt(@intCast(_Q_cmp(a, b)))) != .Equal;
}
fn _Q_flt(a: f128, b: f128) callconv(.c) bool {
return @as(SparcFCMP, @fromBackingInt(@intCast(_Q_cmp(a, b)))) == .Less;
}
fn _Q_fgt(a: f128, b: f128) callconv(.c) bool {
return @as(SparcFCMP, @fromBackingInt(@intCast(_Q_cmp(a, b)))) == .Greater;
}
fn _Q_fge(a: f128, b: f128) callconv(.c) bool {
return switch (@as(SparcFCMP, @fromBackingInt(@intCast(_Q_cmp(a, b))))) {
.Equal, .Greater => true,
.Less, .Unordered => false,
};
}
fn _Q_fle(a: f128, b: f128) callconv(.c) bool {
return switch (@as(SparcFCMP, @fromBackingInt(@intCast(_Q_cmp(a, b))))) {
.Equal, .Less => true,
.Greater, .Unordered => false,
};
}