Inefficiency of `mod'
rugxulo at gmail.com
Tue Oct 26 01:15:02 CEST 2010
On 10/25/10, Maurice Lombardi <Maurice.Lombardi at ujf-grenoble.fr> wrote:
> This means that GPC does an arithmetical right shift (i.e. propagating
> the 1 (or 0) in the leftmost (highest weight) position), while BP does a
> logical right shift.
Right, so GPC does it the same as C (no surprise, GCC-based).
> It seems more sound to use an arithmetical shift for integer and a
> logical shift for cardinal.
Right, so shifting a signed number should keep the sign. (Though
"cardinal" isn't standard Pascal, comes from Modula-2, and Wirth
removed it for Oberon).
Tell me if this helps demonstrate anything:
--- snip ---
CR equ 13
LF equ 10
mov eax,-2 ; = 0xFFFFFFFE
call hexdword ; EAX = 0x7FFFFFFF
call hexdword ; EAX = 0xFFFFFFFF
int 20h ; exit
mov ecx,8 ; 32/4
int 29h ; putchar(AL)
More information about the Gpc