source: branches/ByteArray/Int.pas

Last change on this file was 9, checked in by chronos, 2 months ago
  • Modified: Optimized DeviceMapper read/write handlers calls without case statement.
  • Modified: Use TInt as base data type which can be redefined to different higher integer type. For start it is Int64.
File size: 284 bytes
Line 
1unit Int;
2
3interface
4
5uses
6 Classes, SysUtils;
7
8type
9 TInt = Int64;
10 TIntSize = Byte;
11
12function LimitSize(Value: TInt; Size: TIntSize): TInt;
13
14
15implementation
16
17function LimitSize(Value: TInt; Size: TIntSize): TInt;
18begin
19 Result := Value and ((1 shl (Size * 8)) - 1);
20end;
21
22end.
23
Note: See TracBrowser for help on using the repository browser.