cgen: nofloat for kernel code
parent
5010d18f27
commit
5c4385a472
|
@ -619,6 +619,14 @@ fn (mut g Gen) typ(t ast.Type) string {
|
|||
}
|
||||
|
||||
fn (mut g Gen) base_type(t ast.Type) string {
|
||||
if g.pref.nofloat {
|
||||
// todo compile time if for perf?
|
||||
if t == ast.f32_type {
|
||||
return 'u32'
|
||||
} else if t == ast.f64_type {
|
||||
return 'u64'
|
||||
}
|
||||
}
|
||||
share := t.share()
|
||||
mut styp := if share == .atomic_t { t.atomic_typename() } else { g.cc_type(t, true) }
|
||||
if t.has_flag(.shared_f) {
|
||||
|
|
|
@ -192,6 +192,7 @@ pub mut:
|
|||
is_cstrict bool // turn on more C warnings; slightly slower
|
||||
assert_failure_mode AssertFailureMode // whether to call abort() or print_backtrace() after an assertion failure
|
||||
message_limit int = 100 // the maximum amount of warnings/errors/notices that will be accumulated
|
||||
nofloat bool // for low level code, like kernels: replaces f32 with u32 and f64 with u64
|
||||
// checker settings:
|
||||
checker_match_exhaustive_cutoff_limit int = 12
|
||||
}
|
||||
|
@ -277,6 +278,9 @@ pub fn parse_args(known_external_commands []string, args []string) (&Preferences
|
|||
'-cstrict' {
|
||||
res.is_cstrict = true
|
||||
}
|
||||
'-nofloat' {
|
||||
res.nofloat = true
|
||||
}
|
||||
'-gc' {
|
||||
gc_mode := cmdline.option(current_args, '-gc', '')
|
||||
match gc_mode {
|
||||
|
|
Loading…
Reference in New Issue