-
Notifications
You must be signed in to change notification settings - Fork 0
/
Judy-1.0.5-undefined-behavior.patch
120 lines (104 loc) · 4.51 KB
/
Judy-1.0.5-undefined-behavior.patch
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
diff -crb judy-1.0.5-orig/src/JudyCommon/JudyByCount.c judy-1.0.5/src/JudyCommon/JudyByCount.c
*** judy-1.0.5-orig/src/JudyCommon/JudyByCount.c 2005-02-15 15:06:07.000000000 -0600
--- judy-1.0.5/src/JudyCommon/JudyByCount.c 2014-02-18 13:45:35.225145230 -0600
***************
*** 817,823 ****
// Shorthand for where to find start of Index bytes array:
#ifdef JUDY1
! #define PJI (Pjp->jp_1Index)
#else
#define PJI (Pjp->jp_LIndex)
#endif
--- 817,823 ----
// Shorthand for where to find start of Index bytes array:
#ifdef JUDY1
! #define PJI (Pjp->jp_2Index)
#else
#define PJI (Pjp->jp_LIndex)
#endif
diff -crb judy-1.0.5-orig/src/JudyCommon/JudyGet.c judy-1.0.5/src/JudyCommon/JudyGet.c
*** judy-1.0.5-orig/src/JudyCommon/JudyGet.c 2005-02-15 15:06:07.000000000 -0600
--- judy-1.0.5/src/JudyCommon/JudyGet.c 2014-02-18 13:49:50.840632644 -0600
***************
*** 630,636 ****
#ifdef JUDY1
#define CHECKINDEXNATIVE(LEAF_T, PJP, IDX, INDEX) \
! if (((LEAF_T *)((PJP)->jp_1Index))[(IDX) - 1] == (LEAF_T)(INDEX)) \
return(1)
#define CHECKLEAFNONNAT(LFBTS, PJP, INDEX, IDX, COPY) \
--- 630,636 ----
#ifdef JUDY1
#define CHECKINDEXNATIVE(LEAF_T, PJP, IDX, INDEX) \
! if (((LEAF_T *)((PJP)->jp_2Index))[(IDX) - 1] == (LEAF_T)(INDEX)) \
return(1)
#define CHECKLEAFNONNAT(LFBTS, PJP, INDEX, IDX, COPY) \
diff -crb judy-1.0.5-orig/src/JudyCommon/JudyIns.c judy-1.0.5/src/JudyCommon/JudyIns.c
*** judy-1.0.5-orig/src/JudyCommon/JudyIns.c 2005-02-15 15:06:07.000000000 -0600
--- judy-1.0.5/src/JudyCommon/JudyIns.c 2014-02-18 13:00:49.871850635 -0600
***************
*** 1503,1509 ****
JU_BITMAPSETL(Pjlb, Index);
for (offset = 0; offset < 15; ++offset)
! JU_BITMAPSETL(Pjlb, Pjp->jp_1Index[offset]);
// Set jp_DcdPopO including the current pop0; incremented later:
DcdP0 = (Index & cJU_DCDMASK(1)) + 15 - 1;
--- 1503,1510 ----
JU_BITMAPSETL(Pjlb, Index);
for (offset = 0; offset < 15; ++offset)
! // JU_BITMAPSETL(Pjlb, Pjp->jp_1Index[offset]); // elements 8..15 are optimized out by gcc, so need to do the following
! JU_BITMAPSETL(Pjlb, Pjp->jp_2Index[offset]);
// Set jp_DcdPopO including the current pop0; incremented later:
DcdP0 = (Index & cJU_DCDMASK(1)) + 15 - 1;
diff -crb judy-1.0.5-orig/src/JudyCommon/JudyPrevNext.c judy-1.0.5/src/JudyCommon/JudyPrevNext.c
*** judy-1.0.5-orig/src/JudyCommon/JudyPrevNext.c 2005-02-15 15:06:07.000000000 -0600
--- judy-1.0.5/src/JudyCommon/JudyPrevNext.c 2014-02-18 13:45:40.972875737 -0600
***************
*** 907,913 ****
// Shorthand for where to find start of Index bytes array:
#ifdef JUDY1
! #define PJI (Pjp->jp_1Index)
#else
#define PJI (Pjp->jp_LIndex)
#endif
--- 907,913 ----
// Shorthand for where to find start of Index bytes array:
#ifdef JUDY1
! #define PJI (Pjp->jp_2Index)
#else
#define PJI (Pjp->jp_LIndex)
#endif
diff -crb judy-1.0.5-orig/src/JudyCommon/JudyPrivateBranch.h judy-1.0.5/src/JudyCommon/JudyPrivateBranch.h
*** judy-1.0.5-orig/src/JudyCommon/JudyPrivateBranch.h 2005-02-15 15:06:07.000000000 -0600
--- judy-1.0.5/src/JudyCommon/JudyPrivateBranch.h 2014-02-18 13:00:39.510533765 -0600
***************
*** 86,91 ****
--- 86,98 ----
} jpi_t;
+ typedef struct _JUDY_POINTER_IMMED2 // JPI2.
+ {
+ uint8_t j_pi_2Index[2 * sizeof(Word_t) - 1]; // see above.
+ uint8_t j_pi_Type; // JP type, 1 of cJ*_JPIMMED*.
+ } jpi2_t;
+
+
// UNION OF JP TYPES:
//
// A branch is an array of cJU_BRANCHUNUMJPS (256) of this object, or an
***************
*** 97,102 ****
--- 104,110 ----
{
jpo_t j_po; // other than immediate indexes.
jpi_t j_pi; // immediate indexes.
+ jpi2_t j_pi2; // immediate indexes using j_pi_LIndex as well
} jp_t, *Pjp_t;
// For coding convenience:
***************
*** 105,110 ****
--- 113,119 ----
#define jp_1Index j_pi.j_pi_1Index // for storing Indexes in first word.
#define jp_LIndex j_pi.j_pi_LIndex // for storing Indexes in second word.
+ #define jp_2Index j_pi2.j_pi_2Index // for storing Indexes spanning both words.
#define jp_Addr j_po.j_po_Addr
//#define jp_DcdPop0 j_po.jpo_u.j_po_DcdPop0
#define jp_Type j_po.jpo_u.j_po_Bytes[sizeof(Word_t) - 1]