Module: Rucc::Type::Conv
- Included in:
- Rucc::Type
- Defined in:
- lib/rucc/type/conv.rb
Instance Method Summary collapse
-
#usual_arith_conv(t, u) ⇒ Type
C11 6.3.1.8: Usual arithmetic conversions.
Instance Method Details
#usual_arith_conv(t, u) ⇒ Type
C11 6.3.1.8: Usual arithmetic conversions
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/rucc/type/conv.rb', line 10 def usual_arith_conv(t, u) Util.assert!{ Type.is_arithtype(t) } Util.assert!{ Type.is_arithtype(u) } if (t.kind < u.kind) # Make t the larger type t, u = u, t end return t if Type.is_flotype(t) Util.assert!{ Type.is_inttype(t) && t.size >= Type::INT.size } Util.assert!{ Type.is_inttype(u) && u.size >= Type::INT.size } return t if t.size > u.size Util.assert!{ t.size == u.size } return t if t.usig == u.usig r = t.dup r.usig = true r end |