Article View: comp.windows.ms.programmer
Article #857Re: Huge Pointers
From: pierce
Date: Tue, 06 Oct 1992 22:45
Date: Tue, 06 Oct 1992 22:45
23 lines
1813 bytes
1813 bytes
In article <1992Sep25.175643.6752@pixel.kodak.com>, dj@ekcolor.ssd.kodak.com (Dave Jones) writes: . Matthew Fisher (fisherm@infonode.ingr.com) wrote: . : I have a 2meg array that I have alloced on the global heap. I'm > : accessing this array with huge pointers. The array is made up of structures . : that are 12 bytes long. My pointer manipulation seems to work fine. . : However when one of the structures lay across a 64k boundary my assignment . . Since someone asked for a net post, here goes. . . There is no such thing as a 64K boundary. What there is, is a situation . where the 16-bit offset of a 32-bit pointer wraps around. Huge pointer . arithmetic is supposed to be proof against this because the segment . pointer is adjusted in pointer arithmetic to minimize the offset. In . fact the offset in a "normalized" huge pointer should be no bigger than . 15 decimal. The segment pointer is adjusted to the 16-byte segment . boundary closest to the result address. . ..... Uh, WRONG! In protected mode, you can't do this (the "segment" is a selector that points to a 64K segment. MS specifically sez that HUGE array elements MUST be a power of 2. So, either pad these to 16 bytes each, or use a link list of <64K blocks seperately allocated (kinda brutal). -jrp
Technical Details
Message-ID:
<4405@cruzio.santa-cruz.ca.us>Path:
arc1-ca.pugleaf.net!sparky!uunet!olivea!spool.mu.edu!umn.edu!csus.edu!netcom.com!netcomsv!cruzio!pierceReferences:
<1992Sep23.191958.19524@infonode.ingr.com> <1992Sep25.175643.6752@pixel.kodak.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!olivea!spool.mu.edu!umn.edu!csus.edu!netcom.com!netcomsv!cruzio!pierce From: pierce@cruzio.santa-cruz.ca.us Newsgroups: comp.windows.ms.programmer,comp.os.ms-windows.programmer.misc Subject: Re: Huge Pointers Message-ID: <4405@cruzio.santa-cruz.ca.us> Date: 6 Oct 92 22:45:02 GMT References: <1992Sep23.191958.19524@infonode.ingr.com> <1992Sep25.175643.6752@pixel.kodak.com> Sender: pierce@cruzio.santa-cruz.ca.us Reply-To: pierce@cruzio.santa-cruz.ca.us Lines: 23