From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,3110709241972620,start X-Google-Attributes: gid103376,public From: Randall_Rathbun@rc.trw.com Subject: Packing Record Structures in Ada Date: 1998/01/12 Message-ID: <884639188.24707084@dejanews.com>#1/1 X-Deja-AN: 315438272 X-Http-User-Agent: Mozilla/3.01 (Macintosh; U; 68K) X-Originating-IP-Addr: 129.193.140.10 (dhcp_140_10.rc.trw.com) Organization: Deja News Posting Service X-Authenticated-Sender: Randall_Rathbun@rc.trw.com X-Article-Creation-Date: Mon Jan 12 21:06:29 1998 GMT Reply-To: Randall_Rathbun@rc.trw.com Newsgroups: comp.lang.ada Date: 1998-01-12T00:00:00+00:00 List-Id: Has anyone struggled and fixed the following problem with ordering inside the Ada83 record structure? We are working with two compilers, call them A & B, and they pack the record structure inversely. A typical example: type sample_message_type is record first_field : unsigned_20_bits_type; second_field : unsigned_22_bits_type; third_field : unsigned_22_bits_type; end record sample_message : sample_message_type; When compiler A sends a message out across a bus, it will send |1.........20|21......32| 1st quad-word first field second |1...10|11............32| 2nd quad-word 2nd third field However when the message is received, using compiler B it gets |1.....12|13..........32| 1st quad-word 2nd 1st field |1...........22|23....32| 2nd quad-word 3rd field 2nd (this is due to the way data is sent across the bus, 32 bits at a time) When the 2nd compiler B tries to understand what compiler A sent, it will force its interpretation, but since the relative order has been horizontally flipped, garbage results. One compiler stacks 8 bit bytes left-to-right inside the quadword, the other in the opposite order. If you've encountered this problem in Ada83, and developed work-arounds, I'd like to hear from you Currently we're using a rotate function that uses the "with System" module to remedy this ugly mess. Thanks! please email: Randall_Rathbun@rc.trw.com -------------------==== Posted via Deja News ====----------------------- http://www.dejanews.com/ Search, Read, Post to Usenet