[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: SQR and Bit Manipulation



If the flag fields are numeric, you could do this (assuming flag1=bit0):

let #byte = #flag1 + (#flag2 * 2) + (#flag3 * 4) + (#flag4 * 8) + (#flag5 *
16) + (#flag6 * 32) + (#flag7 * 64) + (#flag8 * 128)

let $byte = chr(#byte)

Good luck!

--
William Beckner -- Stunt Programmer (Just call me "Bill")
Illinois Central College, Rm L141 -- East Peoria, IL  61635-0001
PH: (309) 694-8419 -- FAX: (309) 694-8995
"Take my advice - Don't listen to me!"

                -----Original Message-----
                From:   Dave Thorburn [mailto:thorburn@CONL.NET]
                Sent:   Tuesday, May 30, 2000 11:37 AM
                To:     SQR-USERS@list.iex.net
                Subject:        SQR and Bit Manipulation

                I have a client department that insists on receiving
information
                represented as bits within a one-byte field.

                The values of eight one-byte flags are:

                flag         Value
                ------------------------
                flag1        0
                flag2        0
                flag3        0
                flag4        0 or 1
                flag5        0 or 1
                flag6        0 or 1
                flag7        0 or 1
                flag8        0 or 1

                How do I get these values into a one-byte numeric field
                as bits 0 - 7 (eight bit byte) ???
                ----------------
                Sent from a WebBox - http://www.webbox.com
                FREE Web based Email, Files, Bookmarks, Calendar, People and
                Great Ways to Share them with Others!