home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c031 / 10.ddi / MFC / SRC / OLEPTR_.H$ / oleptr_
Encoding:
Text File  |  1992-01-10  |  1.1 KB  |  48 lines

  1. // This is a part of the Microsoft Foundation Classes C++ library. 
  2. // Copyright (C) 1992 Microsoft Corporation 
  3. // All rights reserved. 
  4. //  
  5. // This source code is only intended as a supplement to the 
  6. // Microsoft Foundation Classes Reference and Microsoft 
  7. // QuickHelp documentation provided with the library. 
  8. // See these sources for detailed information regarding the 
  9. // Microsoft Foundation Classes product. 
  10.  
  11. // Pointer helper inlines (to avoid compiler warnings)
  12.  
  13. static inline void* GetPtrFromFarPtr(void FAR* lp, size_t offset)
  14. {
  15. #ifdef _NEARDATA
  16.     // 16 bit data pointers
  17.     ASSERT(_AFX_FP_SEG(lp) == _segname("_DATA"));
  18.     return ((BYTE *)_AFX_FP_OFF(lp)) - offset;
  19. #else
  20.     // 32 bit data pointers
  21.     return ((BYTE *)lp) - offset;
  22. #endif
  23. }
  24.  
  25. static inline void* GetPtrFromDWord(DWORD dw)
  26. {
  27. #ifdef _NEARDATA
  28.     // 16 bit data pointers
  29.     ASSERT(HIWORD(dw) == 0);
  30.     return (void*)LOWORD(dw);
  31. #else
  32.     // 32 bit data pointers
  33.     return (void*)dw;
  34. #endif
  35. }
  36.  
  37. static inline DWORD GetDWordFromPtr(void* p)
  38. {
  39. #ifdef _NEARDATA
  40.     // 16 bit data pointers
  41.     return MAKELONG((WORD)p, 0);
  42. #else
  43.     // 32 bit data pointers
  44.     return (DWORD)p;
  45. #endif
  46. }
  47.  
  48.