53
const byte *ptr4 = inp + (line_size << 2);
54
const int ls2 = line_size << 1;
51
const byte *ptr4 = inp + (line_size << 2);
52
const int ls2 = line_size << 1;
56
aceg = ((uint)*inp) | ((uint)inp[ls2] << 8) |
57
((uint)*ptr4 << 16) | ((uint)ptr4[ls2] << 24);
58
inp += line_size, ptr4 += line_size;
59
bdfh = ((uint)*inp) | ((uint)inp[ls2] << 8) |
60
((uint)*ptr4 << 16) | ((uint)ptr4[ls2] << 24);
54
aceg = ((uint)*inp) | ((uint)inp[ls2] << 8) |
55
((uint)*ptr4 << 16) | ((uint)ptr4[ls2] << 24);
56
inp += line_size, ptr4 += line_size;
57
bdfh = ((uint)*inp) | ((uint)inp[ls2] << 8) |
58
((uint)*ptr4 << 16) | ((uint)ptr4[ls2] << 24);
63
61
/* Check for all 8 bytes being the same. */
64
62
/* This is especially worth doing for the case where all are zero. */
65
63
if (aceg == bdfh && (aceg >> 8) == (aceg & 0xffffff)) {
66
if (aceg == 0 || aceg == 0xffffffff)
68
*outp = (byte)-(int)((aceg >> 7) & 1);
69
outp[dist] = (byte)-(int)((aceg >> 6) & 1);
71
*outp = (byte)-(int)((aceg >> 5) & 1);
72
outp[dist] = (byte)-(int)((aceg >> 4) & 1);
74
*outp = (byte)-(int)((aceg >> 3) & 1);
75
outp[dist] = (byte)-(int)((aceg >> 2) & 1);
77
*outp = (byte)-(int)((aceg >> 1) & 1);
78
outp[dist] = (byte)-(int)(aceg & 1);
64
if (aceg == 0 || aceg == 0xffffffff)
66
*outp = (byte)-(int)((aceg >> 7) & 1);
67
outp[dist] = (byte)-(int)((aceg >> 6) & 1);
69
*outp = (byte)-(int)((aceg >> 5) & 1);
70
outp[dist] = (byte)-(int)((aceg >> 4) & 1);
72
*outp = (byte)-(int)((aceg >> 3) & 1);
73
outp[dist] = (byte)-(int)((aceg >> 2) & 1);
75
*outp = (byte)-(int)((aceg >> 1) & 1);
76
outp[dist] = (byte)-(int)(aceg & 1);
83
81
/* Transpose a block of bits between registers. */
84
82
#define TRANSPOSE(r,s,mask,shift)\
86
84
s ^= temp << shift)
88
86
/* Transpose blocks of 4 x 4 */
89
TRANSPOSE(aceg, aceg, 0x00000f0f, 20);
90
TRANSPOSE(bdfh, bdfh, 0x00000f0f, 20);
87
TRANSPOSE(aceg, aceg, 0x00000f0f, 20);
88
TRANSPOSE(bdfh, bdfh, 0x00000f0f, 20);
92
90
/* Transpose blocks of 2 x 2 */
93
TRANSPOSE(aceg, aceg, 0x00330033, 10);
94
TRANSPOSE(bdfh, bdfh, 0x00330033, 10);
91
TRANSPOSE(aceg, aceg, 0x00330033, 10);
92
TRANSPOSE(bdfh, bdfh, 0x00330033, 10);
96
94
/* Transpose blocks of 1 x 1 */
97
TRANSPOSE(aceg, bdfh, 0x55555555, 1);
95
TRANSPOSE(aceg, bdfh, 0x55555555, 1);
131
129
register uint len = len1;
136
register const byte *p1 = s1;
137
register const byte *p2 = s2;
134
register const byte *p1 = s1;
135
register const byte *p2 = s2;
141
return (p1[-1] < p2[-1] ? -1 : 1);
139
return (p1[-1] < p2[-1] ? -1 : 1);
143
141
/* Now check for differing lengths */
144
142
return (len1 == len2 ? 0 : len1 < len2 ? -1 : 1);
160
158
const byte *sp = str, *spend = str + len;
163
psmp = &string_match_params_default;
161
psmp = &string_match_params_default;
164
162
again:while (p < pend) {
165
register byte ch = *p;
163
register byte ch = *p;
167
if (ch == psmp->any_substring) {
168
pback = ++p, spback = sp;
170
} else if (ch == psmp->any_char) {
172
return false; /* str too short */
175
} else if (ch == psmp->quote_next) {
177
return true; /* bad pattern */
181
return false; /* str too short */
183
(psmp->ignore_case && (*sp ^ ch) == 0x20 &&
184
(ch &= ~0x20) >= 0x41 && ch <= 0x5a) ||
185
(psmp->slash_equiv && ((ch == '\\' && *sp == '/') ||
186
(ch == '/' && *sp == '\\')))
190
return false; /* no * to back up to */
165
if (ch == psmp->any_substring) {
166
pback = ++p, spback = sp;
168
} else if (ch == psmp->any_char) {
170
return false; /* str too short */
173
} else if (ch == psmp->quote_next) {
175
return true; /* bad pattern */
179
return false; /* str too short */
181
(psmp->ignore_case && (*sp ^ ch) == 0x20 &&
182
(ch &= ~0x20) >= 0x41 && ch <= 0x5a) ||
183
(psmp->slash_equiv && ((ch == '\\' && *sp == '/') ||
184
(ch == '/' && *sp == '\\')))
188
return false; /* no * to back up to */
196
194
if (sp < spend) { /* We got a match, but there are chars left over. */
197
/* If we can back up, back up to the only place that */
198
/* could produce a complete match, otherwise fail. */
203
sp = spend - (pend - p);
195
/* If we can back up, back up to the only place that */
196
/* could produce a complete match, otherwise fail. */
201
sp = spend - (pend - p);
214
212
uid_equal(register const gs_uid * puid1, register const gs_uid * puid2)
216
214
if (puid1->id != puid2->id)
218
216
if (puid1->id >= 0)
219
return true; /* UniqueID */
217
return true; /* UniqueID */
221
!memcmp((const char *)puid1->xvalues,
222
(const char *)puid2->xvalues,
223
(uint) - (puid1->id) * sizeof(long));
219
!memcmp((const char *)puid1->xvalues,
220
(const char *)puid2->xvalues,
221
(uint) - (puid1->id) * sizeof(long));
226
224
/* Copy the XUID data for a uid, if needed, updating the uid in place. */
228
226
uid_copy(gs_uid *puid, gs_memory_t *mem, client_name_t cname)
230
228
if (uid_is_XUID(puid)) {
231
uint xsize = uid_XUID_size(puid);
232
long *xvalues = (long *)
233
gs_alloc_byte_array(mem, xsize, sizeof(long), cname);
229
uint xsize = uid_XUID_size(puid);
230
long *xvalues = (long *)
231
gs_alloc_byte_array(mem, xsize, sizeof(long), cname);
236
return_error(gs_error_VMerror);
237
memcpy(xvalues, uid_XUID_values(puid), xsize * sizeof(long));
238
puid->xvalues = xvalues;
234
return_error(gs_error_VMerror);
235
memcpy(xvalues, uid_XUID_values(puid), xsize * sizeof(long));
236
puid->xvalues = xvalues;
251
249
int_rect_difference(gs_int_rect * outer, const gs_int_rect * inner,
252
gs_int_rect * diffs /*[4] */ )
250
gs_int_rect * diffs /*[4] */ )
254
252
int x0 = outer->p.x, y0 = outer->p.y;
255
253
int x1 = outer->q.x, y1 = outer->q.y;
258
256
if (y0 < inner->p.y) {
259
diffs[0].p.x = x0, diffs[0].p.y = y0;
260
diffs[0].q.x = x1, diffs[0].q.y = min(y1, inner->p.y);
261
outer->p.y = y0 = diffs[0].q.y;
257
diffs[0].p.x = x0, diffs[0].p.y = y0;
258
diffs[0].q.x = x1, diffs[0].q.y = min(y1, inner->p.y);
259
outer->p.y = y0 = diffs[0].q.y;
264
262
if (y1 > inner->q.y) {
265
diffs[count].p.x = x0, diffs[count].p.y = max(y0, inner->q.y);
266
diffs[count].q.x = x1, diffs[count].q.y = y1;
267
outer->q.y = y1 = diffs[count].p.y;
263
diffs[count].p.x = x0, diffs[count].p.y = max(y0, inner->q.y);
264
diffs[count].q.x = x1, diffs[count].q.y = y1;
265
outer->q.y = y1 = diffs[count].p.y;
270
268
if (x0 < inner->p.x) {
271
diffs[0].p.x = x0, diffs[0].p.y = y0;
272
diffs[0].q.x = min(x1, inner->p.x), diffs[0].q.y = y1;
273
outer->p.x = x0 = diffs[count].q.x;
269
diffs[0].p.x = x0, diffs[0].p.y = y0;
270
diffs[0].q.x = min(x1, inner->p.x), diffs[0].q.y = y1;
271
outer->p.x = x0 = diffs[count].q.x;
276
274
if (x1 > inner->q.x) {
277
diffs[count].p.x = max(x0, inner->q.x), diffs[count].p.y = y0;
278
diffs[count].q.x = x1, diffs[count].q.y = y1;
279
outer->q.x = x1 = diffs[count].p.x;
275
diffs[count].p.x = max(x0, inner->q.x), diffs[count].p.y = y0;
276
diffs[count].q.x = x1, diffs[count].q.y = y1;
277
outer->q.x = x1 = diffs[count].p.x;
286
gs_enable_object_tagging(gs_memory_t * mem)
288
if (mem->gs_lib_ctx->BITTAG == GS_DEVICE_DOESNT_SUPPORT_TAGS)
289
mem->gs_lib_ctx->BITTAG = GS_UNKNOWN_TAG;
293
gs_set_object_tag(gs_imager_state * pis, const gs_object_tag_type_t tag)
295
if (pis->memory->gs_lib_ctx->BITTAG != GS_DEVICE_DOESNT_SUPPORT_TAGS) {
296
pis->object_tag = tag;
297
/* mkromfs breaks this dependance
298
NB: needs to be fixed.
299
gx_unset_dev_color(pgs);
301
pis->memory->gs_lib_ctx->BITTAG = tag;
302
/* the assumption is made that the caller will:
303
* gx_set_dev_color(pgs);
309
gs_current_object_tag(gs_memory_t * mem)
311
return mem->gs_lib_ctx->BITTAG;