|
Last change
on this file was 9, checked in by chronos, 15 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 | |
|---|
| 1 | unit Int;
|
|---|
| 2 |
|
|---|
| 3 | interface
|
|---|
| 4 |
|
|---|
| 5 | uses
|
|---|
| 6 | Classes, SysUtils;
|
|---|
| 7 |
|
|---|
| 8 | type
|
|---|
| 9 | TInt = Int64;
|
|---|
| 10 | TIntSize = Byte;
|
|---|
| 11 |
|
|---|
| 12 | function LimitSize(Value: TInt; Size: TIntSize): TInt;
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 | implementation
|
|---|
| 16 |
|
|---|
| 17 | function LimitSize(Value: TInt; Size: TIntSize): TInt;
|
|---|
| 18 | begin
|
|---|
| 19 | Result := Value and ((1 shl (Size * 8)) - 1);
|
|---|
| 20 | end;
|
|---|
| 21 |
|
|---|
| 22 | end.
|
|---|
| 23 |
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.