mirror of
https://github.com/irmen/prog8.git
synced 2025-03-01 00:30:03 +00:00
fix missing float casts
This commit is contained in:
parent
225295a7d8
commit
8d0607ef58
@ -217,8 +217,9 @@ internal class AugmentableAssignmentAsmGen(private val program: Program,
|
||||
if(!childIDt.isKnown)
|
||||
throw AssemblyError("unknown dt")
|
||||
val childDt = childIDt.typeOrElse(DataType.STRUCT)
|
||||
if (value.type.equalsSize(childDt) || value.type.largerThan(childDt)) {
|
||||
if (value.type!=DataType.FLOAT && (value.type.equalsSize(childDt) || value.type.largerThan(childDt))) {
|
||||
// this typecast is redundant here; the rest of the code knows how to deal with the uncasted value.
|
||||
// (works for integer types, not for float.)
|
||||
inplaceModification(target, operator, value.expression)
|
||||
return true
|
||||
}
|
||||
|
@ -6,16 +6,37 @@
|
||||
main {
|
||||
|
||||
sub start() {
|
||||
float t = 0.0
|
||||
|
||||
repeat 10 {
|
||||
float cosa = cos(t)
|
||||
float sina = sin(t)
|
||||
float cosb = cos(t*0.33)
|
||||
float sinb = sin(t*0.33)
|
||||
float cosc = cos(t*0.78)
|
||||
float sinc = sin(t*0.78)
|
||||
}
|
||||
; byte bb = 4
|
||||
; bb += sgn(bb+bb)
|
||||
; txt.print_b(bb)
|
||||
; txt.chrout('\n')
|
||||
;
|
||||
; word ww = 4
|
||||
; ww += sgn(ww+ww)
|
||||
; txt.print_w(ww)
|
||||
; txt.chrout('\n')
|
||||
|
||||
float x = 4
|
||||
x += abs(x+x)
|
||||
floats.print_f(x)
|
||||
txt.chrout('\n')
|
||||
|
||||
x = 4
|
||||
x += sgn(x+x) ; TODO missing byte->float cast in assembly??? Also fucks up stack
|
||||
x += sgn(x+x) ; TODO missing byte->float cast in assembly??? Also fucks up stack
|
||||
x += sgn(x+x) ; TODO missing byte->float cast in assembly??? Also fucks up stack
|
||||
floats.print_f(x)
|
||||
txt.chrout('\n')
|
||||
|
||||
; repeat 10 {
|
||||
; float cosa = cos(t)
|
||||
; float sina = sin(t)
|
||||
; float cosb = cos(t*0.33)
|
||||
; float sinb = sin(t*0.33)
|
||||
; float cosc = cos(t*0.78)
|
||||
; float sinc = sin(t*0.78)
|
||||
; }
|
||||
|
||||
testX()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user