We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0394937 commit 3f82d7aCopy full SHA for 3f82d7a
1 file changed
src/crt/fneg.src
@@ -23,13 +23,23 @@
23
.type __fneg, @function
24
25
__fneg:
26
- or a,a
27
- jr nz,__noexit
+ ; Common case (A != 0) : 5F + 3R + 0W + 2
+ ; A:UBC == 0.0f : 12F + 6R + 3W + 3
28
+ ; positive subnormal : 14F + 6R + 3W + 3
29
+ add a, $7F
30
+ inc a
31
+ ret po
32
+ ; input == [+0.0f, +FLT_MIN * 2.0f)
33
+ ; we need to make sure we do not output -0.0f, so we need to make sure that the mantissa is not zero.
34
+ ; A is $80 here
35
+ rla ; set carry (and set A to $00)
36
push hl
- sbc hl,hl
- sbc hl,bc
37
+ sbc hl, hl
38
+ add hl, bc
39
pop hl
- ret z
-__noexit:
- xor a,80h
40
+.if 1
41
+ ; we can optionally return here to make the A:UBC == 0.0f case slightly faster.
42
+ ret nc
43
+.endif
44
+ rra ; A = (BC != 0) ? $80 : $00
45
ret
0 commit comments