home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!news.larc.nasa.gov!hal.larc.nasa.gov!alan
- From: alan@hal.larc.nasa.gov (alan dare)
- Newsgroups: comp.lang.c
- Subject: Pointer to a short struct????
- Date: 18 Nov 1992 22:00:50 GMT
- Organization: NASA Langley Research Center, Hampton, VA USA
- Lines: 22
- Distribution: usa
- Message-ID: <1eeeeiINNae6@rave.larc.nasa.gov>
- NNTP-Posting-Host: hal.larc.nasa.gov
- Originator: alan@hal.larc.nasa.gov
-
-
- I am mapping (mmap) a board that pulls information from an external
- data bus into my programs address space. The data is in a packed format.
- Instead of using shifts and masks to extract the data I planed on using bit
- fields. Major Problem: A structure seems to have a minimum width of an
- integer (32 bits). However, the dual ported memory is 16 bits wide. Thus I
- can't use a structure/field pointer into the cards memory because I will not
- always be on a 32 bit word boundary (core dump: bus error). Currently I get
- around thus by copying the short word from the card into an integer and
- applying the pointer to the bit field to it. However, this requires that I
- copy each word from the 256K DYNAMIC memory (I'm reading an active bus and
- trying to decode and extract information). It's slow and painful to copy
- each short into an integer. The million dollar question is: Is it possible
- to have a structure smaller than a full word, like a short? If so whats
- the declaration?
-
- Thanks
- --
-
- *********************************************************************
- Alan Dare | Internet : alan@hal.larc.nasa.gov
- NASA Langley Research Center |
-