From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 5FB79BCAF for ; Thu, 16 Jun 2005 20:25:06 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j5GIP6wZ001775 for ; Thu, 16 Jun 2005 20:25:06 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id UAA16976 for ; Thu, 16 Jun 2005 20:25:05 +0200 (MET DST) Received: from smtp10.wanadoo.fr (smtp10.wanadoo.fr [193.252.22.21]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j5GIP57m021231 for ; Thu, 16 Jun 2005 20:25:05 +0200 Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf1004.wanadoo.fr (SMTP Server) with ESMTP id 530A7240015F for ; Thu, 16 Jun 2005 20:25:05 +0200 (CEST) Received: from morgana (ARennes-257-1-27-174.w81-53.abo.wanadoo.fr [81.53.10.174]) by mwinf1004.wanadoo.fr (SMTP Server) with ESMTP id 2F0C7240015E for ; Thu, 16 Jun 2005 20:25:05 +0200 (CEST) X-ME-UUID: 20050616182505192.2F0C7240015E@mwinf1004.wanadoo.fr Received: from david by morgana with local (Exim 4.50) id 1Diz32-00019Y-B6 for caml-list@inria.fr; Thu, 16 Jun 2005 20:25:04 +0200 To: caml-list@inria.fr Subject: How to handle endianness and binary string conversion for 32 bits integers (Int32)? From: David MENTRE Organization: none Date: Thu, 16 Jun 2005 20:25:04 +0200 Message-ID: <87slzima67.fsf@linux-france.org> User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Miltered: at nez-perce with ID 42B1C402.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 42B1C401.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; binary:01 integers:01 endian:01 integers:01 binary:01 buffer:01 runtime:01 structures:01 int:01 data:02 string:03 string:03 bits:04 bits:04 machine:08 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.2 X-Spam-Level: Hello, I would like to: 1. convert between big and little endian 32 bits integers; 2. convert between 32 bits integers and string binary representation (to store integers in Buffer and string data structures); 3. detect machine endianness at runtime. How could I do that? My main issue is the point 2. I know some of my issues have been already discussed on this list but I have been unable to google them. Yours, d. -- pub 1024D/A3AD7A2A 2004-10-03 David MENTRE 5996 CC46 4612 9CA4 3562 D7AC 6C67 9E96 A3AD 7A2A