comp.lang.ada
 help / color / mirror / Atom feed
From: "Stephen Frackelton" <stephen.frackelton@baesystems.com>
Subject: Convert array to integer value
Date: Thu, 23 May 2002 15:49:24 +0100
Date: 2002-05-23T15:49:24+01:00	[thread overview]
Message-ID: <3ced014d$1@pull.gecm.com> (raw)

I have set up an array of integers, value 0..1, to simulate a word, 16 bits.

I need to convert this array of 0's and 1's from the binary value to its
corresponding integer value.

is there any simple way of doing this ?

All i can think of is for loop through the array and having a translation
table for each position within the array, i.e if bit 5 = 1 then add 16 to
total, if bit 6 = 1 then add 32 to total and so on.

any other ideas ?


thanks

Stephen





             reply	other threads:[~2002-05-23 14:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-23 14:49 Stephen Frackelton [this message]
2002-05-23 15:00 ` Convert array to integer value Nige
2002-05-23 15:27   ` Stephen Frackelton
2002-05-23 16:36     ` Stephen Leake
2002-05-23 15:35 ` David Gillon
2002-05-24  8:22   ` Stuart Palin
  -- strict thread matches above, loose matches on Subject: below --
2002-05-23 16:49 Beard, Frank [Contractor]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox