Read file/stream
Steven Schveighoffer
schveiguy at yahoo.com
Mon Mar 14 05:52:30 PDT 2011
On Fri, 11 Mar 2011 17:39:43 -0500, Stewart Gordon <smjg_1998 at yahoo.com>
wrote:
> On 11/03/2011 21:51, Steven Schveighoffer wrote:
> <snip>
>>> Presumably there's a reason that it's been provided for uint but not
>>> ushort or ulong....
>>
>> I think things in std.intrinsic are functions that tie directly to CPU
>> features,
>
> True, but...
>
>> so presumably, the CPU only provides the possibility for 4-byte width.
>
> D is designed to run on a variety of CPUs. Do you really think that
> they all have a built-in instruction to reverse the order of 4 bytes but
> no other number?
No, but if the CPU does not support it, the compiler must simulate it for
that platform. I don't know the reasoning behind only supporting 4 bytes,
but I'm sure it has something to do with IP addresses being 4 bytes that
probably makes CPUs support that specific length more prevalently.
I suspect the decision to create an intrinsic or just a regular function
is highly subjective (i.e. how many CPUs must support an optimized version
in order to make it an intrinsic), so you'd have to ask Walter why it's
not in there.
-Steve
More information about the Digitalmars-d-learn
mailing list