Jump to content

DosGetHugeShift: Difference between revisions

From EDM2
Created page with "image:legacy.png This function has been eliminated since OS/2 2.0 [https://books.google.com.ec/books?id=u7WbsmbttwYC&pg=PT372&lpg=PT372&dq#v=onepage&q&f=false] ==Descript..."
 
Ak120 (talk | contribs)
mNo edit summary
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[image:legacy.png]]
{{Legacy
This function has been eliminated since OS/2 2.0 [https://books.google.com.ec/books?id=u7WbsmbttwYC&pg=PT372&lpg=PT372&dq#v=onepage&q&f=false]
|RepFunc=N/A
 
|Remarks=This function has been eliminated since OS/2 2.0. [http://books.google.com/books?id=u7WbsmbttwYC&pg=PT372]
==Description==
}}
This call returns a shift count used to derive the selectors that address memory allocated with DosAllocHuge.  
This call returns a shift count used to derive the selectors that address memory allocated with [[DosAllocHuge]].


==Syntax==
==Syntax==
<PRE>
  DosGetHugeShift (ShiftCount)
  DosGetHugeShift


    (ShiftCount)
</PRE>
==Parameters==
==Parameters==
; ShiftCount (PUSHORT) - output : Address of the shift count.
;ShiftCount (PUSHORT) - output: Address of the shift count.


==Return Code==
==Return Code==
rc (USHORT) - return
;rc (USHORT) - return:Return code description is:
 
*0 NO_ERROR
Return code description is:
 
* 0   NO_ERROR


==Remarks==
==Remarks==
Each segment of a huge memory allocation has a unique selector. To compute the next sequential selector in a huge memory area, take the value 1, shift it left by the number of bits specified in shift count. Use the resulting value as an increment to add to the previous selector (using the selector returned by DosAllocHuge as the first selector). For example:
Each segment of a huge memory allocation has a unique selector. To compute the next sequential selector in a huge memory area, take the value 1, shift it left by the number of bits specified in shift count. Use the resulting value as an increment to add to the previous selector (using the selector returned by DosAllocHuge as the first selector). For example:
 
* Assume DosAllocHuge is issued with NumSeg equal to 3, and that the number 63 is returned for the selector of the first segment.
* Assume DosAllocHuge is issued with NumSeg equal to 3, and that the number 63 is returned for the selector of the first segment.  
* If DosGetHugeShift returns a shift count of 4, shifting the value "1" by this amount results in an increment of 16.
* If DosGetHugeShift returns a shift count of 4, shifting the value "1" by this amount results in an increment of 16.  
* Adding this increment to selector number 63 produces 79 for the second selector. Adding the same increment to selector number 79 yields 95 for the third selector.
* Adding this increment to selector number 63 produces 79 for the second selector. Adding the same increment to selector number 79 yields 95 for the third selector.


==Example Code==
==Bindings==
===C Binding===
===C===
<PRE>
<PRE>
#define INCL_DOSMEMMGR
#define INCL_DOSMEMMGR
Line 35: Line 28:
USHORT  rc = DosGetHugeShift(ShiftCount);
USHORT  rc = DosGetHugeShift(ShiftCount);


PUSHORT         ShiftCount;    /* Shift Count (returned) */
PUSHORT ShiftCount;    /* Shift Count (returned) */
 
USHORT rc;            /* return code */
USHORT           rc;            /* return code */
</PRE>
</PRE>


===MASM Binding===
===MASM===
<PRE>
<PRE>
EXTRN  DosGetHugeShift:FAR
EXTRN  DosGetHugeShift:FAR
Line 50: Line 42:
Returns WORD
Returns WORD
</PRE>
</PRE>
==Related Functions==
*


[[Category:The OS/2 API Project]]
[[Category:Dos16]]

Latest revision as of 00:31, 5 October 2023

Legacy Function Warning
It is recommended to use a newer replacement for this function.
Replacement: N/A
Remarks: This function has been eliminated since OS/2 2.0. [1]

This call returns a shift count used to derive the selectors that address memory allocated with DosAllocHuge.

Syntax

DosGetHugeShift (ShiftCount)

Parameters

ShiftCount (PUSHORT) - output
Address of the shift count.

Return Code

rc (USHORT) - return
Return code description is:
  • 0 NO_ERROR

Remarks

Each segment of a huge memory allocation has a unique selector. To compute the next sequential selector in a huge memory area, take the value 1, shift it left by the number of bits specified in shift count. Use the resulting value as an increment to add to the previous selector (using the selector returned by DosAllocHuge as the first selector). For example:

  • Assume DosAllocHuge is issued with NumSeg equal to 3, and that the number 63 is returned for the selector of the first segment.
  • If DosGetHugeShift returns a shift count of 4, shifting the value "1" by this amount results in an increment of 16.
  • Adding this increment to selector number 63 produces 79 for the second selector. Adding the same increment to selector number 79 yields 95 for the third selector.

Bindings

C

#define INCL_DOSMEMMGR

USHORT  rc = DosGetHugeShift(ShiftCount);

PUSHORT ShiftCount;    /* Shift Count (returned) */
USHORT  rc;            /* return code */

MASM

EXTRN  DosGetHugeShift:FAR
INCL_DOSMEMMGR      EQU 1

PUSH@  WORD    ShiftCount    ;Shift Count (returned)
CALL   DosGetHugeShift

Returns WORD