MathgeomGLS
65 строк · 3.4 Кб
1{---------------------------------------------------------------------------}
2{ }
3{ File: Velthuis.Sizes.pas }
4{ Function: Constants for sizes and bit sizes of Delphi's integral types. }
5{ Language: Delphi version XE3 or later }
6{ Author: Rudy Velthuis }
7{ Copyright: (c) 2016 Rudy Velthuis }
8{ }
9{ License: Redistribution and use in source and binary forms, with or }
10{ without modification, are permitted provided that the }
11{ following conditions are met: }
12{ }
13{ * Redistributions of source code must retain the above }
14{ copyright notice, this list of conditions and the following }
15{ disclaimer. }
16{ * Redistributions in binary form must reproduce the above }
17{ copyright notice, this list of conditions and the following }
18{ disclaimer in the documentation and/or other materials }
19{ provided with the distribution. }
20{ }
21{ Disclaimer: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" }
22{ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT }
23{ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND }
24{ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO }
25{ EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE }
26{ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, }
27{ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, }
28{ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, }
29{ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED }
30{ AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT }
31{ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) }
32{ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF }
33{ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. }
34{ }
35{---------------------------------------------------------------------------}
36
37unit Velthuis.Sizes;38
39interface
40
41const
42CUInt8Bits = 8;43CInt8Bits = CUInt8Bits - 1;44CUInt16Bits = 16;45CInt16Bits = CUInt16Bits - 1;46CUInt32Bits = 32;47CInt32Bits = CUInt32Bits - 1;48CUInt64Bits = 64;49CInt64Bits = CUInt64Bits - 1;50CByteBits = CUInt8Bits;51CShortintBits = CByteBits - 1;52CWordBits = CByteBits * SizeOf(Word);53CSmallintBits = CWordBits - 1;54
55// Note: up to XE8, Longword and Longint were fixed sizes (32 bit). This has changed in XE8.56CLongwordBits = CByteBits * SizeOf(Longword);57CLongintBits = CLongwordBits - 1;58
59// Note: up to XE8, Integer and Cardinal were platform dependent. This has changed in XE8.60CCardinalBits = CByteBits * SizeOf(Cardinal);61CIntegerBits = CCardinalBits - 1;62
63implementation
64
65end.66
67
68
69
70
71