> I wonder are there any hardware instructions to > perform byte swaps (endian conversions) in SPARC? > For example, if I open a data file that is stored in > little-endian format, I would like to be able to > read and convert the data as efficiently as > possible. It would be very nice if I can mmap the > data regions (as it were in big endian) and monkey > with the data natives.... but that is too much to > ask....
If one must implement byte swaps, the best speed is achieved with ROR and ROL instructions. All CPUs, be they CISC or RISC, have those two in one form or another. To be concrete on SPARC(TM) the instructions you're looking for are SLL and SLR. Be that as it may, you will find everything you wanted to know, and a lot more that you probably didn't here: http://www.sparc.com/ This message posted from opensolaris.org _______________________________________________ opensolaris-discuss mailing list [email protected]
