home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / c / 16737 < prev    next >
Encoding:
Internet Message Format  |  1992-11-18  |  1.5 KB

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