[Forces-protocol] Re: Data encoding -- first part

Alan DeKok <alan.dekok@idt.com> Wed, 20 October 2004 02:07 UTC

Received: from ietf-mx.ietf.org (ietf-mx.ietf.org [132.151.6.1]) by ietf.org (8.9.1a/8.9.1a) with ESMTP id WAA15890 for <forces-protocol-web-archive@ietf.org>; Tue, 19 Oct 2004 22:07:30 -0400 (EDT)
Received: from megatron.ietf.org ([132.151.6.71]) by ietf-mx.ietf.org with esmtp (Exim 4.33) id 1CK65I-0003BY-1q for forces-protocol-web-archive@ietf.org; Tue, 19 Oct 2004 22:20:16 -0400
Received: from localhost.localdomain ([127.0.0.1] helo=megatron.ietf.org) by megatron.ietf.org with esmtp (Exim 4.32) id 1CK45c-0001Sr-0y; Tue, 19 Oct 2004 20:12:28 -0400
Received: from odin.ietf.org ([132.151.1.176] helo=ietf.org) by megatron.ietf.org with esmtp (Exim 4.32) id 1CJvOB-0006ez-61 for forces-protocol@megatron.ietf.org; Tue, 19 Oct 2004 10:55:03 -0400
Received: from ietf-mx.ietf.org (ietf-mx.ietf.org [132.151.6.1]) by ietf.org (8.9.1a/8.9.1a) with ESMTP id KAA03532 for <forces-protocol@ietf.org>; Tue, 19 Oct 2004 10:54:55 -0400 (EDT)
Received: from [66.46.215.210] (helo=post.ott.idt.com) by ietf-mx.ietf.org with esmtp (Exim 4.33) id 1CJvaJ-0007oi-KE for forces-protocol@ietf.org; Tue, 19 Oct 2004 11:07:35 -0400
Received: from [127.0.0.1] (dhcp195.ott.idt.com [192.168.102.195]) by post.ott.idt.com (Postfix) with ESMTP id C5C631F0002; Tue, 19 Oct 2004 10:54:26 -0400 (EDT)
Message-ID: <417529DC.8000704@idt.com>
Date: Tue, 19 Oct 2004 10:51:08 -0400
From: Alan DeKok <alan.dekok@idt.com>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.3) Gecko/20040910
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: Zsolt Haraszti <zsolt@modularnet.com>
References: <468F3FDA28AA87429AD807992E22D07E025791E5@orsmsx408> <002d01c4b50b$1ecc9c10$020aa8c0@wwm1> <1098102734.1042.134.camel@jzny.localdomain> <1098113089.2364.12.camel@localhost.localdomain> <1098115003.2884.67.camel@localhost.localdomain> <4173FB88.1000008@idt.com> <1098126011.2884.162.camel@localhost.localdomain> <41741D78.4070205@idt.com> <1098132328.2884.250.camel@localhost.localdomain>
In-Reply-To: <1098132328.2884.250.camel@localhost.localdomain>
Content-Type: text/plain; charset="us-ascii"; format="flowed"
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Scan-Signature: e1e48a527f609d1be2bc8d8a70eb76cb
Content-Transfer-Encoding: 7bit
Cc: "Khosravi, Hormuzd M" <hormuzd.m.khosravi@intel.com>, ram.gopal@nokia.com, "Yang, Lily L" <lily.l.yang@intel.com>, "Joel M. Halpern" <jhalpern@megisto.com>, forces-protocol@ietf.org, Jamal Hadi Salim <hadi@znyx.com>, "Steven Blake (petri-meat)" <slblake@petri-meat.com>, Ellen M Deleganes <ellen.m.deleganes@intel.com>, Weiming Wang <wmwang@mail.hzic.edu.cn>
Subject: [Forces-protocol] Re: Data encoding -- first part
X-BeenThere: forces-protocol@ietf.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: forces-protocol <forces-protocol.ietf.org>
List-Unsubscribe: <https://www1.ietf.org/mailman/listinfo/forces-protocol>, <mailto:forces-protocol-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www1.ietf.org/pipermail/forces-protocol>
List-Post: <mailto:forces-protocol@ietf.org>
List-Help: <mailto:forces-protocol-request@ietf.org?subject=help>
List-Subscribe: <https://www1.ietf.org/mailman/listinfo/forces-protocol>, <mailto:forces-protocol-request@ietf.org?subject=subscribe>
Sender: forces-protocol-bounces@ietf.org
Errors-To: forces-protocol-bounces@ietf.org
X-Spam-Score: 0.0 (/)
X-Scan-Signature: 4adaf050708fb13be3316a9eee889caa
Content-Transfer-Encoding: 7bit

Zsolt Haraszti wrote:

>>   The problem is that ANSI C struct representation is 
>>platform-specific.  Some platforms can pack multiple 'uint8_t' into a 
>>32-bit word.  Others can't.
> 
> Can you give me an example of a platform where it is not done?

   DSP's, for one.  sizeof(char) == sizeof(short) == sizeof(int) == 8.

> Actually, I checked the same simple C test code both on my Intel
> and PowerPC hosts, and found that the layout was the same on
> both, albeit the bytes ordering _inside_ 32-bit and 16-bit integer
> fields were naturally the opposite.

   Did you use the same compiler?  Not that that matters much, the 
struct packign should be the same across all compilers on the same 
architecture.

   Maybe my worries are not relevant.  I just remember having problems 
with this sort of thing in the past.


> OK, lets say I was wrong, and the memory layout is (very)
> platform-specific.  E.g., 64-bit platforms do it differently
> than others.  That means we cannot come up with a layout that
> pleases everyone (every platform).  What shall we do then?
 >
> One approach is to screw everyone, but make it a clean design.
> E.g., no alignment at all, i.e., only 8-bit alignment.

   Yuck.

> Another approach is to try to be nice to pre-dominant platforms,
> and feel sorry for the rest.

   That sounds like a plan.

   Alan DeKok.



_______________________________________________
Forces-protocol mailing list
Forces-protocol@ietf.org
https://www1.ietf.org/mailman/listinfo/forces-protocol