reduce unnecessary casts in C output
This commit is contained in:
parent
9826201343
commit
5018cf9b2e
@ -1,4 +1,5 @@
|
|||||||
def v2i{x:T & w256{T}} = [32]u8 ~~ x # for compact casting for the annoying intrinsic type system
|
# compact casting for the annoying intrinsic type system
|
||||||
|
def v2i{x:T & w256{T}} = if(isint{eltype{T}}) x else [32]u8 ~~ x
|
||||||
def v2f{x:T & w256{T}} = [8]f32 ~~ x
|
def v2f{x:T & w256{T}} = [8]f32 ~~ x
|
||||||
def v2d{x:T & w256{T}} = [4]f64 ~~ x
|
def v2d{x:T & w256{T}} = [4]f64 ~~ x
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,7 @@ oper ~~ reinterpret infix right 55
|
|||||||
oper ** broadcast infix right 55
|
oper ** broadcast infix right 55
|
||||||
def Size = u64
|
def Size = u64
|
||||||
def load{x} = *x
|
def load{x} = *x
|
||||||
|
def reinterpret{T, x:X & T==X} = x
|
||||||
def exportN{f, ...ns} = each{{n} => export{n, f}, ns}
|
def exportN{f, ...ns} = each{{n} => export{n, f}, ns}
|
||||||
def exportT{name, fs} = { v:*type{tupsel{0,fs}} = fs; export{name, v} }
|
def exportT{name, fs} = { v:*type{tupsel{0,fs}} = fs; export{name, v} }
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
def v2i{x:T & w128{T}} = [16]u8 ~~ x # for compact casting for the annoying intrinsic type system
|
# compact casting for the annoying intrinsic type system
|
||||||
|
def v2i{x:T & w128{T}} = if(isint{eltype{T}}) x else [16]u8 ~~ x
|
||||||
def v2f{x:T & w128{T}} = [4]f32 ~~ x
|
def v2f{x:T & w128{T}} = [4]f32 ~~ x
|
||||||
def v2d{x:T & w128{T}} = [2]f64 ~~ x
|
def v2d{x:T & w128{T}} = [2]f64 ~~ x
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user