]> git.sur5r.net Git - cc65/blobdiff - libsrc/runtime/axlong.s
Added further optimizations and unit tests.
[cc65] / libsrc / runtime / axlong.s
index 6d97b5025bf885895e734e8f5a1ca9168056d18b..02d0a825c01323f8729c607d08d87b4f24fb05e7 100644 (file)
@@ -1,5 +1,6 @@
 ;
 ; Ullrich von Bassewitz, 25.10.2000
+; Christian Krueger, 02-Mar-2017, some bytes saved
 ;
 ; CC65 runtime: Convert int in ax into a long
 ;
 
 ; Convert AX from int to long in EAX
 
+axlong: ldy     #$ff
+        cpx     #$80            ; Positive?
+        bcs     store           ; No, apply $FF
+
 axulong:
         ldy     #0
-        sty     sreg
-        sty     sreg+1
-        rts
-
-axlong: cpx     #$80            ; Positive?
-        bcc     axulong         ; Yes, handle like unsigned type
-        ldy     #$ff
-        sty     sreg
+store:  sty     sreg
         sty     sreg+1
         rts
 
-
-