Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Endianness
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Simplified access to part of a field === On most systems, the address of a multi-byte value is the address of its first byte (the byte with the lowest address); little-endian systems of that type have the property that, for sufficiently low data values, the same value can be read from memory at different lengths without using different addresses (even when [[byte alignment|alignment]] restrictions are imposed). For example, a 32-bit memory location with content {{code|4A 00 00 00|class=nowrap}} can be read at the same address as either [[8-bit]] (value = 4A), [[16-bit]] (004A), [[24-bit]] (00004A), or [[32-bit]] (0000004A), all of which retain the same numeric value. Although this little-endian property is rarely used directly by high-level programmers, it is occasionally employed by code optimizers as well as by [[assembly language]] programmers. While not allowed by C++, such [[type punning]] code is allowed as "implementation-defined" by the C11 standard<ref>{{cite web |title = C11 standard |url = https://www.iso.org/standard/57853.html |publisher = ISO |access-date = 15 August 2018 |at = Section 6.5.2.3 "Structure and Union members", Β§3 and footnote 95 |archive-date = 28 March 2020 |archive-url = https://web.archive.org/web/20200328063511/https://www.iso.org/standard/57853.html |url-status = live }}</ref> and commonly used<ref>{{cite web |title=3.10 Options That Control Optimization: -fstrict-aliasing |url=https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#Type-punning |website=GNU Compiler Collection (GCC) |publisher=Free Software Foundation |access-date=15 August 2018 |archive-date=1 July 2023 |archive-url=https://web.archive.org/web/20230701053330/https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#Type-punning |url-status=live }}</ref> in code interacting with hardware.<ref>{{cite mailing list |first=Linus |last=Torvalds |title=[GIT PULL] Device properties framework update for v4.18-rc1 |url=https://lkml.org/lkml/2018/6/5/769 |mailing-list=Linux Kernel |access-date=15 August 2018 |date=5 Jun 2018 |archive-date=15 August 2018 |archive-url=https://web.archive.org/web/20180815090956/https://lkml.org/lkml/2018/6/5/769 |url-status=live }}</ref>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)