GUI library for D

Nick Sabalausky a at a.a
Wed Apr 6 13:17:21 PDT 2011


"Nick Sabalausky" <a at a.a> wrote in message 
news:inihjp$hnp$1 at digitalmars.com...
> "Adam D. Ruppe" <destructionator at gmail.com> wrote in message 
> news:ini1jr$2lj3$1 at digitalmars.com...
>>
>> Aye, even my homegrown DOS would always write them separately.
>> Horrible waste of instructions doing another y << 8 + y << 6 when
>> a simple "inc ax" would suffice!
>>
>
> Yup, exactly. Which reminds me, I've always wanted to actually check to 
> see if modern compilers (or at least DMD) would be smart enough to 
> optimize something like:
>
> for(i in 128...256)
>    arr[i] = ...;
>
> Into something like:
>
> auto ptr = arr.ptr + 128;
> auto ptrEnd = arr.ptr + 256;
> for(; ptr < ptrEnd; ptr++)
>    *ptr = ...;
>

Actually, I meant more like this:

enum width = 512;
int x = 10;
for(y in 128...256)
   arr[y * width + x] = ...;

to this:

enum width = 512;
int x = 10;
auto ptr = arr.ptr + 128*width + x;
auto ptrEnd = arr.ptr + 256*width + x;
for(; ptr < ptrEnd; ptr += width)
   *ptr = ...;





More information about the Digitalmars-d mailing list