aboutsummaryrefslogtreecommitdiff
path: root/lib/compiler_rt/fixdfei.zig
blob: 31c7994c58c59062bf8c67cbfbe856eddbb7f503 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
const std = @import("std");
const builtin = @import("builtin");
const common = @import("common.zig");
const bigIntFromFloat = @import("int_from_float.zig").bigIntFromFloat;

pub const panic = common.panic;

comptime {
    @export(&__fixdfei, .{ .name = "__fixdfei", .linkage = common.linkage, .visibility = common.visibility });
}

pub fn __fixdfei(r: [*]u8, bits: usize, a: f64) callconv(.c) void {
    const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits));
    return bigIntFromFloat(.signed, @ptrCast(@alignCast(r[0..byte_size])), a);
}