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
FourCC
(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!
=== Compiler support === FourCC is written in big endian relative to the underlying ASCII character sequence, so that it appears in the correct byte order when read as a string. Many C compilers, including GCC, define a [[C syntax#Character constants|multi-character literal]] behavior of right-aligning to the least significant byte, so that {{code|'1234'}} becomes <code>0x3'''1'''3'''2'''3'''3'''3'''4'''</code> in ASCII.<ref>{{cite web |title=The C Preprocessor: Implementation-defined behavior |url=https://gcc.gnu.org/onlinedocs/cpp/Implementation-defined-behavior.html |website=gcc.gnu.org}}</ref> This is the conventional way of writing FourCC codes used by Mac OS programmers for OSType. ([[Classic Mac OS]] was exclusively big-endian.) On little-endian machines, a byte-swap on the value is required to make the result correct. Taking the avc1 example from above: although the literal {{tt|'avc1'}} already converts to the integer value {{tt|0x61766331}}, a little-endian machine would have reversed the byte order and stored the value as {{tt|31 63 76 61}}. To yield the correct byte sequence {{tt|61 76 63 31}}, the pre-swapped value {{tt|0x31637661}} is used.
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)