home *** CD-ROM | disk | FTP | other *** search
/ Solo Programadores 22 / SOLO_22.iso / packages / win32ada / data.z / win32-utils.adb < prev    next >
Encoding:
Text File  |  1995-11-17  |  3.0 KB  |  93 lines

  1. -- $Source: /home/harp/1/proto/monoBANK/winnt/win32-utils.adb,v $ 
  2. -- $Revision: 1.5 $ $Date: 95/02/02 15:57:31 $ $Author: mg $
  3. -------------------------------------------------------------------------------
  4. --
  5. -- THIS FILE AND ANY ASSOCIATED DOCUMENTATION IS FURNISHED "AS IS" WITHOUT 
  6. -- WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 
  7. -- TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR 
  8. -- PURPOSE.  The user assumes the entire risk as to the accuracy and the 
  9. -- use of this file.
  10. --
  11. -- Copyright (c) Intermetrics, Inc. 1995
  12. -- Royalty-free, unlimited, worldwide, non-exclusive use, modification, 
  13. -- reproduction and further distribution of this file is permitted.
  14. --
  15. -------------------------------------------------------------------------------
  16.  
  17.  
  18. with Interfaces;
  19.  
  20. package body Win32.Utils is
  21.  
  22.     use Interfaces;                                         -- to get operators
  23.  
  24.     -- windef.h
  25.     function MAKEWORD(Low, High: BYTE) return WORD is
  26.     begin
  27.         return WORD(
  28.             Shift_Left(Interfaces.Unsigned_16(High), 8) or 
  29.             Interfaces.Unsigned_16(Low));
  30.     end MAKEWORD;
  31.  
  32.     function MAKELONG(Low, High: WORD) return DWORD is
  33.     begin
  34.         return DWORD(
  35.             Shift_Left(Interfaces.Unsigned_32(High), 16) or 
  36.             Interfaces.Unsigned_32(Low));
  37.     end MAKELONG;
  38.  
  39.     function LOWORD(L: DWORD) return WORD is
  40.     begin
  41.         return WORD(Unsigned_32(L) and 16#FFFF#);
  42.     end LOWORD;
  43.  
  44.     function HIWORD(L: DWORD) return WORD is
  45.     begin
  46.         return WORD(Shift_Right(Unsigned_32(L), 16));
  47.     end HIWORD;
  48.  
  49.     function LOBYTE(W: WORD) return BYTE is
  50.     begin
  51.         return BYTE(Unsigned_16(W) and 16#FF#);
  52.     end LOBYTE;
  53.  
  54.     function HIBYTE(W: WORD) return BYTE is
  55.     begin
  56.         return BYTE(Shift_Right(Unsigned_16(W), 8));
  57.     end HIBYTE;
  58.  
  59.     -- winnt.h
  60.     function Int32x32To64(A, B: Signed_DWORD) return Signed_QWORD is
  61.     begin
  62.         return Signed_QWORD(A) * Signed_QWORD(B);
  63.     end Int32x32To64;
  64.  
  65.     function UInt32x32To64(A, B: DWORD) return QWORD is
  66.     begin
  67.         return QWORD(A) * QWORD(B);
  68.     end UInt32x32To64;
  69.  
  70.     function Int64ShllMod32 (Val: QWORD; By : Shift_Count) return QWORD is
  71.     begin
  72.         return QWORD(Interfaces.Shift_Left(
  73.                      Interfaces.Unsigned_64(Val), Natural(By)));
  74.     end Int64ShllMod32;
  75.  
  76.     function Int64ShraMod32 (Val: Signed_QWORD;
  77.                              By : Shift_Count) return Signed_QWORD is
  78.     begin
  79.         return Signed_QWORD(
  80.             Interfaces.Shift_Right_Arithmetic(Interfaces.Unsigned_64(Val), 
  81.                                               Natural(By)));
  82.     end Int64ShraMod32;
  83.  
  84.     function Int64ShrlMod32 (Val: QWORD;
  85.                              By : Shift_Count) return QWORD is
  86.     begin
  87.         return QWORD(Interfaces.Shift_Right(
  88.                      Interfaces.Unsigned_64(Val), Natural(By)));
  89.     end Int64ShrlMod32;
  90.  
  91.     procedure Null_Proc is begin null; end;
  92. end Win32.Utils;
  93.