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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,553a6b79b2471571 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!news4.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Tue, 18 Jul 2006 22:01:50 -0500 From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: How do you bitwise operations in Ada '83 and '95 References: <1153244316.853254.291560@m79g2000cwm.googlegroups.com> X-Newsreader: Tom's custom newsreader Message-ID: Date: Tue, 18 Jul 2006 22:01:50 -0500 NNTP-Posting-Host: 67.164.83.70 X-Trace: sv3-eRPSlYOkTN2gWhpD5t1yOC3q2q94CWsl9FZsZapUzD/bNyeNAzxUntl3A3AMfK7RTaLqeVyE1UshH9s!iOfunxXaer1QeGUjiykBWOi0tVWKV3zpoA6M/AuBMdpU0zOHB88OPoZDlhykkDNLl6tQrQiZv6xF!G3iVCvFWovl2Cw== X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news2.google.com comp.lang.ada:5796 Date: 2006-07-18T22:01:50-05:00 List-Id: Several people have shown handling an array of bits, whether an "array" or a suitably wide modular type. But perhaps you want to deal with things stored in bit fields. For instance, from CLAW's Windows keyboard interface: type Keypress_Info_Type is record Repeat_Count : Integer range 0 .. 32767; Scan_Code : Integer range 0 .. 255; Is_Extended_Key : Boolean; Also_Alt : Boolean; Key_Was_Down : Boolean; Is_Keyup : Boolean; end record; for Keypress_Info_Type use record Repeat_Count at 0 range 0 .. 15; Scan_Code at 0 range 16 .. 23; Is_Extended_Key at 0 range 24 .. 24; Also_Alt at 0 range 29 .. 29; Key_Was_Down at 0 range 30 .. 30; Is_Keyup at 0 range 31 .. 31; end record; for Keypress_Info_Type'size use 32; then you can do, eg, procedure Process_Keypress(Keypress : in Keypress_Info_Type) is begin if Keypress.Repeat_Count > 0 or Keypress.Is_Extended_Key then ...