half and quad

Bill Baxter dnewsgroup at billbaxter.com
Fri Oct 12 00:57:24 PDT 2007


Anders F Björklund wrote:
> Bill Baxter wrote:
> 
>>> But I do have a port of "half" (from OpenEXR) kicking around here
>>> somewhere, it's basically using ushort and converts over to float.
>>>
>>> See http://www.digitalmars.com/d/archives/digitalmars/D/31899.html
>>
>> I wonder if 'half' is really worth it though.  It seems like more of a 
>> temporary stop-gap measure to deal with memory and throughput problems 
>> on a GPU.  In 5 years maybe people will look at 'half' and laugh about 
>> how primitive the architectures were back in the 00's.  Also since D 
>> isn't going to run on a GPU any time soon, and CPUs aren't going to 
>> implement 'half' any time soon (AFAIK), maybe this doesn't make too 
>> much sense.
> 
> D doesn't have to be run *on* the GPU in order to need the same type...
> (it's useful for manipulating data that is later going to be sent over)
> 
> But you are right that half is just a lower resolution version of float,
> just like 16-bit color and 16-bit integers. And while you could just
> use 32-bit always (or 64-bit, just for the overkill), sometimes you do
> have to worry about performance or memory or bandwidth constraints ?

I don't have anything against putting a half type in.
I guess I'd rather see it as something like an intrinsic module than a 
reserved keyword, though.  Something implemented by the compiler, but 
you have to do an import to get at it.

Realistically, not that large a percentage of the whole user base is 
going to have a need for it, so this keeps it out of the hair of e.g. 
web developers and DB programmers.

--bb



More information about the Digitalmars-d mailing list