home *** CD-ROM | disk | FTP | other *** search
- -- $Source: /home/harp/1/proto/monoBANK/winnt/win32-utils.adb,v $
- -- $Revision: 1.5 $ $Date: 95/02/02 15:57:31 $ $Author: mg $
- -------------------------------------------------------------------------------
- --
- -- THIS FILE AND ANY ASSOCIATED DOCUMENTATION IS FURNISHED "AS IS" WITHOUT
- -- WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
- -- TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
- -- PURPOSE. The user assumes the entire risk as to the accuracy and the
- -- use of this file.
- --
- -- Copyright (c) Intermetrics, Inc. 1995
- -- Royalty-free, unlimited, worldwide, non-exclusive use, modification,
- -- reproduction and further distribution of this file is permitted.
- --
- -------------------------------------------------------------------------------
-
-
- with Interfaces;
-
- package body Win32.Utils is
-
- use Interfaces; -- to get operators
-
- -- windef.h
- function MAKEWORD(Low, High: BYTE) return WORD is
- begin
- return WORD(
- Shift_Left(Interfaces.Unsigned_16(High), 8) or
- Interfaces.Unsigned_16(Low));
- end MAKEWORD;
-
- function MAKELONG(Low, High: WORD) return DWORD is
- begin
- return DWORD(
- Shift_Left(Interfaces.Unsigned_32(High), 16) or
- Interfaces.Unsigned_32(Low));
- end MAKELONG;
-
- function LOWORD(L: DWORD) return WORD is
- begin
- return WORD(Unsigned_32(L) and 16#FFFF#);
- end LOWORD;
-
- function HIWORD(L: DWORD) return WORD is
- begin
- return WORD(Shift_Right(Unsigned_32(L), 16));
- end HIWORD;
-
- function LOBYTE(W: WORD) return BYTE is
- begin
- return BYTE(Unsigned_16(W) and 16#FF#);
- end LOBYTE;
-
- function HIBYTE(W: WORD) return BYTE is
- begin
- return BYTE(Shift_Right(Unsigned_16(W), 8));
- end HIBYTE;
-
- -- winnt.h
- function Int32x32To64(A, B: Signed_DWORD) return Signed_QWORD is
- begin
- return Signed_QWORD(A) * Signed_QWORD(B);
- end Int32x32To64;
-
- function UInt32x32To64(A, B: DWORD) return QWORD is
- begin
- return QWORD(A) * QWORD(B);
- end UInt32x32To64;
-
- function Int64ShllMod32 (Val: QWORD; By : Shift_Count) return QWORD is
- begin
- return QWORD(Interfaces.Shift_Left(
- Interfaces.Unsigned_64(Val), Natural(By)));
- end Int64ShllMod32;
-
- function Int64ShraMod32 (Val: Signed_QWORD;
- By : Shift_Count) return Signed_QWORD is
- begin
- return Signed_QWORD(
- Interfaces.Shift_Right_Arithmetic(Interfaces.Unsigned_64(Val),
- Natural(By)));
- end Int64ShraMod32;
-
- function Int64ShrlMod32 (Val: QWORD;
- By : Shift_Count) return QWORD is
- begin
- return QWORD(Interfaces.Shift_Right(
- Interfaces.Unsigned_64(Val), Natural(By)));
- end Int64ShrlMod32;
-
- procedure Null_Proc is begin null; end;
- end Win32.Utils;
-