-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathFastBase64Const.pas
More file actions
121 lines (101 loc) · 4.14 KB
/
FastBase64Const.pas
File metadata and controls
121 lines (101 loc) · 4.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
unit FastBase64Const;
interface
// ###########################################
// #### Common definitions and constants used in 64 and 32 bit assembler functions
// ###########################################
type
TYMMB = Array[0..31] of byte;
TYMMS = Array[0..31] of shortint;
TYMMDW = Array[0..7] of UInt32;
TYMMI = Array[0..7] of Int32;
TXMM = Array[0..3] of Uint32; // for register save
// ###########################################
// #### Decoding constants
// ###########################################
const cLutLo : TYMMB = (
$15, $11, $11, $11, $11, $11, $11, $11,
$11, $11, $13, $1A, $1B, $1B, $1B, $1A,
$15, $11, $11, $11, $11, $11, $11, $11,
$11, $11, $13, $1A, $1B, $1B, $1B, $1A
);
cLutHi : TYMMB = (
$10, $10, $01, $02, $04, $08, $04, $08,
$10, $10, $10, $10, $10, $10, $10, $10,
$10, $10, $01, $02, $04, $08, $04, $08,
$10, $10, $10, $10, $10, $10, $10, $10
);
cLutRoll : TYMMS = (
0, 16, 19, 4, -65, -65, -71, -71,
0, 0, 0, 0, 0, 0, 0, 0,
0, 16, 19, 4, -65, -65, -71, -71,
0, 0, 0, 0, 0, 0, 0, 0
);
cMask2F : TYMMB = (
$2f, $2f, $2f, $2f, $2f, $2f, $2f, $2f,
$2f, $2f, $2f, $2f, $2f, $2f, $2f, $2f,
$2f, $2f, $2f, $2f, $2f, $2f, $2f, $2f,
$2f, $2f, $2f, $2f, $2f, $2f, $2f, $2f
);
cMerge : TYMMDW = (
$01400140, $01400140, $01400140, $01400140,
$01400140, $01400140, $01400140, $01400140 );
cMergeAdd : TYMMDW = (
$00011000, $00011000, $00011000, $00011000,
$00011000, $00011000, $00011000, $00011000 );
cShufOut : TYMMS = (
2, 1, 0, 6, 5, 4, 10, 9, 8, 14, 13, 12, -1, -1, -1, -1,
2, 1, 0, 6, 5, 4, 10, 9, 8, 14, 13, 12, -1, -1, -1, -1 );
cPermOut : TYMMI = ( 0, 1, 2, 4, 5, 6, -1, -1 );
// a record that cumulates the decoding constants so we can use it in
// the AVX routins directly and in older Delphi versions (the disassembler output did not work properly)
type
TAVXDecodeConst = packed record
LutLo : TYMMB;
LutHi : TYMMB;
LutRoll : TYMMS;
Mask2F : TYMMB;
Merge : TYMMDW;
MergeAdd : TYMMDW;
ShufOut : TYMMS;
PermOut : TYMMI;
end;
PAVXDecodeConst = ^TAVXDecodeConst;
// ###########################################
// #### Encoding constants
// ###########################################
// constants used in the encoding process
const cMaskMov : TYMMDW = ($00000000, $80000000, $80000000, $80000000,
$80000000, $80000000, $80000000, $80000000 );
cLut0 : TYMMB = (
5, 4, 6, 5, 8, 7, 9, 8, 11, 10, 12, 11, 14, 13, 15, 14,
1, 0, 2, 1, 4, 3, 5, 4, 7, 6, 8, 7, 10, 9, 11, 10 );
cLut1 : TYMMS = (
65, 71, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -19, -16, 0, 0,
65, 71, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -19, -16, 0, 0);
cMask0 : TYMMDW = ( $0FC0FC00, $0FC0FC00, $0FC0FC00, $0FC0FC00,
$0FC0FC00, $0FC0FC00, $0FC0FC00, $0FC0FC00 );
cMask1 : TYMMDW = ( $04000040, $04000040, $04000040, $04000040,
$04000040, $04000040, $04000040, $04000040 );
cMask2 : TYMMDW = ( $003F03F0, $003F03F0, $003F03F0, $003F03F0,
$003F03F0, $003F03F0, $003F03F0, $003F03F0 );
cMask3 : TYMMDW = ( $01000010, $01000010, $01000010, $01000010,
$01000010, $01000010, $01000010, $01000010 );
cN51 : TYMMDW = ($33333333, $33333333, $33333333, $33333333,
$33333333, $33333333, $33333333, $33333333);
cN25 : TYMMDW = ($19191919, $19191919, $19191919, $19191919,
$19191919, $19191919, $19191919, $19191919);
type
TAVXEncodeConst = packed record
MaskMov : TYMMDW;
Lut0 : TYMMB;
Lut1 : TYMMS;
Mask0 : TYMMDW;
Mask1 : TYMMDW;
Mask2 : TYMMDW;
Mask3 : TYMMDW;
N51 : TYMMDW;
N25 : TYMMDW;
end;
PAVXEncodeConst = ^TAVXEncodeConst;
implementation
end.