From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeff Garzik Subject: Re: [Patch] chunkd: use port xxx82 to build Date: Wed, 12 Aug 2009 20:11:02 -0400 Message-ID: <4A835A16.5030000@garzik.org> References: <15247558.1250120567558.JavaMail.root@elwamui-huard.atl.sa.earthlink.net> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <15247558.1250120567558.JavaMail.root@elwamui-huard.atl.sa.earthlink.net> Sender: hail-devel-owner@vger.kernel.org List-ID: Content-Type: text/plain; charset="us-ascii"; format="flowed" To: Rick Peralta Cc: Pete Zaitcev , Project Hail List Rick Peralta wrote: > There is code to byte swap in the network stack. ntoh() and friends should do the job. Unfortunately that isn't the best solution for us, for a few reasons: * There is no 64-bit variant, which we need. * The system platform definitions of ntohl() etc. can vary between macros and function calls depending on compiler's -O settings, which complicates debugging (at least for me). * ntohl() forces big endian. Given the current landscape of commodity hardware, I intentionally chose little endian over big endian. That will completely eliminate byte-swapping for the primary platforms' byte order. We use the GLib byte order facilities, which provide little endian variants and are portable (along with the rest of GLib) across modern platforms. But GUINT*_{FROM,TO}_LE macros come with the minor disadvantages of all macros, namely a lack of type safety, problems with multiple evaluation, etc. Regards, Jeff