![]() ![]() The best way to write portable code that will work as intended is to treat all data coming from disk or over the wire as a bag of bytes, and not attempt to alias it to a struct. Recently, most compilers on most architectures standardized on self-alignment rules for all primitive types except char, but this is not guaranteed by the standard, it will bite you in the ass when you least expect it, and it will be decades yet before all the C code in the world is displaced by a single-implementation language like Rust. The reason for this is that when you define a struct in C(++), there are not just endianness issues, but implementation-dependent issues of padding and alignment you have to consider. The correct way to handle binary data is to unpack it into the struct byte by byte. ![]() This is how horrors and abominations like. No no no don't do this don't do this don't do this. > Swapping bytes is a huge pain in the butt! When reading large binary files, it's so convenient and efficient to be able to mmap and make struct pointers right into the file. I get the feeling the general attitude on this thread is that such platforms are unimportant, but that doesn't mean it's not a broken promise. IMHO, this is a broken promise about how the Web was supposed to be platform-independent. Fortunately, TenFourFox doesn't support WebGL, so we don't need to worry about that. This mostly works for sites that care and has almost no overhead in JITted code for 16 and 32-bit int, but Facebook managed to break some of our assumptions with floats (example: - we don't byteswap floats because it's expensive and probably would break things expecting native endian on the DOM side). TenFourFox and Leopard Webkit both emulate little-endian typed arrays on BE Power Macs and transparently byteswap integers. For example, the WhatsApp Web QR code generator won't run on a BE platform it's an Emscriptenized blob of code backing it that assumes the typed array it stores into has LE orientation. Emscripten hastened this by letting site owners compile little-endian code into little-endian asm.js. You can not only assume it, but I can also say with certainty it exists. refusal to consider bitcasts between SIMD vectors of the same bit width but different number of lanes as portable/safe operation in language design.) The cost–benefit of software accommodating big-endian systems will look increasingly bad with legacy enterprise servers imposing a negative externality on everyone else. Therefore, it won't be feasible to try to re-introduce big endian to systems that need to be competitive at rendering the Web.īig endian will stay alive for the time being on home routers and Sparc servers, and probably for a long time on IBM z systems. ![]() It's not performance-wise competitive for a WebGL system to present little-endian behavior on big-endian hardware. It's safe to assume, therefore, that there's a mass of Web content that only works if the browser exposes little-endian behavior to JS. Web devs don't need to test on big-endian systems and would have a hard time finding big-endian systems to test with even if they wanted to. This makes the big-endian provisions of the spec a dead letter. WebGL exposes endianness and happened at a time when almost all systems running browsers are little-endian. In his spare time Steve directs Argonotes, the Toronto Argonauts Band, which he thinks is the finest band in the Canadian Football League.Big endian is dead on the client. A frequent speaker at Apple's WorldWide Developer Conference, he's currently a field resource for Apple on the topics of Unix, the Mac OS X developer tools and the Cocoa, AppleScript Studio and WebObjects developer environments. You can imagine his delight as Apple acquired NeXT and the NEXTSTEP operating system evolved into Mac OS X. Steve joined NeXT Computer in 1991, attracted by NeXT's blend of a powerful Unix core with a great graphical interface. After graduating from Waterloo with an M.Math in 1986, he earned his hacker credentials as a Unix network manager for UW and Indiana University at the latter institution he became the first, and perhaps the last, private individual in the entire state of Indiana to purchase a NeXT cube. ![]() Steve Hayman is a National Consulting Engineer for Apple's US Education Sales group, based, oddly enough, in Toronto. We'll look at building applications with Xcode and Interface Builder the role of scripting languages including Applescript, Ruby and Python alongside C and Objective-C reusing objects from Apple's Cocoa, WebKit and ImageKit frameworks nifty higher level tools including Automator, for workflow design, and the groundbreaking Quartz Composer graphic development environment and if Steve messes up, we may see some brief usage of the debugger as well. Join Steve as he talks about software development on the Mac with Apple's Xcode tool suite. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |