[Oberon] Constant folding, Re: Bit-fiddling: SETs and type c

Andreas Pirklbauer andreas_pirklbauer at yahoo.com
Tue Aug 9 17:48:27 CEST 2022


CORRECTION: And of course, one also needs to reverse the sign inside the new brackets ( “-" instead of “+" )


    PROCEDURE P;
       VAR ch: CHAR;
    BEGIN ch := CHR(ORD(ch) - (ORD("a") - ORD("A”)))
    END P;


   2   90E00004  LDR  R0 SP       4
   3   40090020  SUB  R0  R0     32         # ORD(“a) - ORD(“A”)  =  97 - 65  = 32 --> constants folded
   4   B0E00004  STR   R0 SP       4




More information about the Oberon mailing list