Common type of ubyte and const ubyte is int

Daniel N no at public.email
Fri May 3 12:23:31 UTC 2024


On Friday, 3 May 2024 at 07:05:21 UTC, Richard (Rikki) Andrew 
Cattermole wrote:
>
> Due to C its pretty safe to assume that 32bit registers will be 
> pretty heavily optimized for 32bit or above processes.
>
> Consider the Ice Lake series, which last had releases in 2020.
>
> DIV IDIV	r8	4	4
> DIV IDIV	r16	4	4
> DIV IDIV	r32	4	4
> DIV IDIV	r64	4	4
>
> Now compare that to Haswell architecture from 10 years ago:
>
> DIV	r8	9	9
> DIV	r16	11	11
> DIV	r32	10	10
> DIV	r64	36	36
> IDIV	r8	9	9
> IDIV	r16	10	10
> IDIV	r32	9	9
> IDIV	r64	59	59
>
> If you don't know the exact target CPU sticking with 32bit is 
> still a good recommendation for CPU's that are 32bit or above.
>
> On the other hand if you know its more recent (say running 
> Windows 11), just use whatever you need and don't worry about 
> it.

That's an interesting data-point, however x86 is unusual in that 
is supports all register sizes, on other CPUs you have to 
manually mask the result.



More information about the Digitalmars-d mailing list