[cc65] char = int / 8

Date view Thread view Subject view

From: MagerValp (MagerValp_at_cling.gu.se)
Date: 2003-10-03 20:54:42


This little snippet:

  void test(void) {
    unsigned int i = 257;
    unsigned char c;

    c = i / 8;
  }

Generates this:

;
; unsigned int i = 257;
;
	lda     #$01
	sta     L0003
	sta     L0003+1
;
; c = i / 8;
;
	lda     L0003
	lsr     a
	lsr     a
	lsr     a
	sta     L0005

Which isn't exactly what I expected. Explicit casts doesn't seem to
help. Am I or the compiler wrong?

-- 
                       Wildstar delenda est
    ___          .     .  .         .       . +  .         .      o   
  _|___|_   +   .  +     .     +         .  Per Olofsson, arkadspelare
    o-o    .      .     .   o         +          MagerValp_at_cling.gu.se
     -       +            +    .     http://www.cling.gu.se/~cl3polof/
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2003-10-03 20:57:30 CEST