digitalmars.D.bugs - missing bswap(ushort) intrinsic
- =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= (10/14) Oct 28 2004 A 16-bit byte swap seems to be missing ?
A 16-bit byte swap seems to be missing ? (from std.intrinsic, only has a 32-bit) I know that the i486+ only has a "BSWAP" instruction, but others might have it... Here is my "all-D" implementation:ushort bswap(ushort v) { return ((v<<8)|(v>>>8)); }You can add masks if you want to ? --anders PS. I have heard that "bswap" is slow on e.g. the Pentium IV CPU, anyway ? (but I haven't done any benchmarking)
Oct 28 2004