We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7726475 commit eb8f9d0Copy full SHA for eb8f9d0
src/generators/hl2c.ml
@@ -811,7 +811,11 @@ let generate_function ctx f =
811
sexpr "%s = %ld" (reg r) code.ints.(idx)
812
| OFloat (r,idx) ->
813
let fstr = sprintf "%.19g" code.floats.(idx) in
814
- sexpr "%s = %s" (reg r) (if String.contains fstr '.' || String.contains fstr 'e' then fstr else fstr ^ ".")
+ let fstr = (if String.contains fstr '.' || String.contains fstr 'e' then fstr else fstr ^ ".") in
815
+ (match rtype r with
816
+ | HF32 -> sexpr "%s = %sf" (reg r) fstr
817
+ | _ -> sexpr "%s = %s" (reg r) fstr
818
+ );
819
| OBool (r,b) ->
820
sexpr "%s = %s" (reg r) (if b then "true" else "false")
821
| OBytes (r,idx) ->
0 commit comments