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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.224.72.199 with SMTP id n7mr2495102qaj.5.1365299143455; Sat, 06 Apr 2013 18:45:43 -0700 (PDT) X-Received: by 10.49.6.66 with SMTP id y2mr1345796qey.18.1365299143443; Sat, 06 Apr 2013 18:45:43 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!mx05.eternal-september.org!feeder.eternal-september.org!news.glorb.com!ca1no32931449qab.0!news-out.google.com!ef9ni9246qab.0!nntp.google.com!ca1no32931445qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 6 Apr 2013 18:45:43 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=69.20.190.126; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 69.20.190.126 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <4a0e3b63-7139-4f03-bae2-35beca608bda@googlegroups.com> Subject: General integer-types. From: Shark8 Injection-Date: Sun, 07 Apr 2013 01:45:43 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:14902 Date: 2013-04-06T18:45:43-07:00 List-Id: I'm toying with the idea of making a SWF-player (I found the documentation = for the format online) and was wondering about the integers. Sure I could w= rite out all of them (8-bit, 16-bit, 32-bit)x(signed, unsigned) + 64-bit un= signed =3D 7-types -- not too bad, but this is a lot of repetition so coul= d I make a generic to qualify? Generic Size : Positive; Package SWF_Integer is Exp : Constant Positive :=3D Size-1; =09 -- For some reason adding the "New Long_Long_Integer" allows -- this to compile... but it might ignore the Size aspect. Type Signed is New Long_Long_Integer Range -2**Exp..2**Exp-1 with Size =3D> Size; =20 -- This doesn't work at all; Size is not static.=09 Type Unsigned is Mod 0..2**Size with Size =3D> Size; =09 End SWF_Integer; The specs are as follows: > Integer types and byte order > The SWF file format uses 8-bit, 16-bit, 32-bit, 64-bit, signed,=20 > and unsigned integer types. All integer values are stored in the > SWF file by using little-endian byte order: the least > significant byte is stored first, and the most significant byte > is stored last, in the same way as the Intel x86 architecture. > The bit order within bytes in the SWF file format is big-endian: > the most significant bit is stored first, and the least > significant bit is stored last. >=20 > All integer types must be byte-aligned. That is, the first bit > of an integer value must be stored in the first bit of a byte in > the SWF file. Would the bit_order definition work on ensuring the correct representation?= The documentation seems to indicate it is for the bit-numbering in record-= representations. Further, would the alignment definition (alignment =3D> 1?= 8?) be appropriate?