🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #121

Help with bit and byte addressable bitfields

#121
From: Ken Bass
Date: Sun, 26 Jul 1992 04:39
23 lines
1103 bytes
I'd like to know your suggestions on how to define and access a bitfield
that is both bit and byte addressable. The application is to maintain a
ram image in a memory mapped i/o system.

Lets say we have WidgetRamImg of type WidgetRamImgDef where

typedef struct {
   unsigned int bit0;
         ...
   unsigned int bit32;
} WidgetRamImgDef;

WidgetRamImgDef WidgetRamImg;

I'd like to say WidgetRamImg=0x0; at init time, but the type is wrong.
Casting to WidgetRamImgDef does not work either.

Any suggestions?

-- 
Ken Bass (kbass@gmuvax2.gmu.edu)              |   Telecommunications  
George Mason University                       |   Techniques Corp, 
Student, Department of Electrical Engineering |   Software Engineer 
Technical Details
Message-ID: <1992Jul26.043900.7020@gmuvax2.gmu.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!haven.umd.edu!news.umbc.edu!gmuvax2!kbass

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!sparky!uunet!haven.umd.edu!news.umbc.edu!gmuvax2!kbass
From: kbass@gmuvax2.gmu.edu (Ken Bass)
Subject: Help with bit and byte addressable bitfields
Message-ID: <1992Jul26.043900.7020@gmuvax2.gmu.edu>
Organization: George Mason University, Fairfax, Va.
Distribution: na
Date: Sun, 26 Jul 1992 04:39:00 GMT
Lines: 23