1 /* This is free and unencumbered software released into the public domain. */
2 
3 module drylib;
4 
5 import std.bigint : BigInt;
6 
7 ////////////////////////////////////////////////////////////////////////////////
8 // Type Definitions
9 
10 // Boolean (true or false)
11 alias Bool = bool;
12 
13 // Character
14 alias Char = dchar;
15 
16 // Complex number (arbitrary size)
17 alias Complex = creal; // FIXME
18 
19 // Floating-point number (native size)
20 alias Float = real;
21 
22 // Floating-point number (32-bit single-precision)
23 alias Float32 = float;
24 
25 // Floating-point number (64-bit double-precision)
26 alias Float64 = double;
27 
28 // Integer number (native size)
29 static if (size_t.sizeof >= 8)
30   alias Int = long; // 64-bit
31 else
32   alias Int = int;  // 32-bit
33 
34 // Integer number (8-bit)
35 alias Int8 = byte;
36 
37 // Integer number (16-bit)
38 alias Int16 = short;
39 
40 // Integer number (32-bit)
41 alias Int32 = int;
42 
43 // Integer number (64-bit)
44 alias Int64 = long;
45 
46 // Integer number (128-bit)
47 //alias Int128 = cent; // TODO
48 
49 // Integer number (arbitrary size)
50 alias Integer = BigInt;
51 
52 // Natural number (arbitrary size)
53 alias Natural = Integer;
54 
55 // Rational number (arbitrary size)
56 struct Rational {
57 public:
58   Integer numerator;
59   Integer denominator;
60 }
61 
62 // Real number (arbitrary size)
63 struct Real {
64 public:
65   Float64 value; // FIXME
66 }
67 
68 // Machine word (native size)
69 static if (size_t.sizeof >= 8)
70   alias Word = ulong; // 64-bit
71 else
72   alias Word = uint;  // 32-bit
73 
74 // Machine word (8-bit)
75 alias Word8 = ubyte;
76 
77 // Machine word (16-bit)
78 alias Word16 = ushort;
79 
80 // Machine word (32-bit)
81 alias Word32 = uint;
82 
83 // Machine word (64-bit)
84 alias Word64 = ulong;