Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There is a comment by sophisticles that fundamentally misunderstands the cost of an endian swap.

It costs nothing other than having separate instructions for the different endian types.

The reason for this is that on the transistor level it takes exactly zero transistors to implement a byte swap since all you are changing is in which order the wires are connected.

Forcing software to deal with the pain of big endian support in exchange for saving a nonexistent cost in hardware is such a bad trade that it's on the same level of stupidity as not applying a clear coat on a car and then seeing them rust and expecting the owner of the car to thoroughly wax the car frequently to prevent the inevitable formation of rust.

 help



It doesn't take zero transistors, at the very least you will need a multiplexer to choose between the two encodings. But such a mux is less than 10 transistors per bit, a rounding error for any modern CPU.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: