|
|
|
@ -7,7 +7,7 @@
|
|
|
|
|
#define MAYBE_UNUSED
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
u32 generate_cmask (const u32 value)
|
|
|
|
|
DECLSPEC u32 generate_cmask (const u32 value)
|
|
|
|
|
{
|
|
|
|
|
const u32 rmask = ((value & 0x40404040u) >> 1u)
|
|
|
|
|
& ~((value & 0x80808080u) >> 2u);
|
|
|
|
@ -18,7 +18,7 @@ u32 generate_cmask (const u32 value)
|
|
|
|
|
return rmask & ~hmask & lmask;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void truncate_right (u32 *buf0, u32 *buf1, const u32 offset)
|
|
|
|
|
DECLSPEC void truncate_right (u32 *buf0, u32 *buf1, const u32 offset)
|
|
|
|
|
{
|
|
|
|
|
const u32 tmp = (1u << ((offset & 3u) * 8u)) - 1u;
|
|
|
|
|
|
|
|
|
@ -77,7 +77,7 @@ void truncate_right (u32 *buf0, u32 *buf1, const u32 offset)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void truncate_left (u32 *buf0, u32 *buf1, const u32 offset)
|
|
|
|
|
DECLSPEC void truncate_left (u32 *buf0, u32 *buf1, const u32 offset)
|
|
|
|
|
{
|
|
|
|
|
const u32 tmp = ~((1u << ((offset & 3u) * 8u)) - 1u);
|
|
|
|
|
|
|
|
|
@ -136,7 +136,7 @@ void truncate_left (u32 *buf0, u32 *buf1, const u32 offset)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void lshift_block (const u32 *in0, const u32 *in1, u32 *out0, u32 *out1)
|
|
|
|
|
DECLSPEC void lshift_block (const u32 *in0, const u32 *in1, u32 *out0, u32 *out1)
|
|
|
|
|
{
|
|
|
|
|
out0[0] = hc_bytealign_S (in0[1], in0[0], 1);
|
|
|
|
|
out0[1] = hc_bytealign_S (in0[2], in0[1], 1);
|
|
|
|
@ -148,7 +148,7 @@ void lshift_block (const u32 *in0, const u32 *in1, u32 *out0, u32 *out1)
|
|
|
|
|
out1[3] = hc_bytealign_S ( 0, in1[3], 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void rshift_block (const u32 *in0, const u32 *in1, u32 *out0, u32 *out1)
|
|
|
|
|
DECLSPEC void rshift_block (const u32 *in0, const u32 *in1, u32 *out0, u32 *out1)
|
|
|
|
|
{
|
|
|
|
|
out1[3] = hc_bytealign_S (in1[3], in1[2], 3);
|
|
|
|
|
out1[2] = hc_bytealign_S (in1[2], in1[1], 3);
|
|
|
|
@ -160,7 +160,7 @@ void rshift_block (const u32 *in0, const u32 *in1, u32 *out0, u32 *out1)
|
|
|
|
|
out0[0] = hc_bytealign_S (in0[0], 0, 3);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void lshift_block_N (const u32 *in0, const u32 *in1, u32 *out0, u32 *out1, const u32 num)
|
|
|
|
|
DECLSPEC void lshift_block_N (const u32 *in0, const u32 *in1, u32 *out0, u32 *out1, const u32 num)
|
|
|
|
|
{
|
|
|
|
|
switch (num)
|
|
|
|
|
{
|
|
|
|
@ -455,7 +455,7 @@ void lshift_block_N (const u32 *in0, const u32 *in1, u32 *out0, u32 *out1, const
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void rshift_block_N (const u32 *in0, const u32 *in1, u32 *out0, u32 *out1, const u32 num)
|
|
|
|
|
DECLSPEC void rshift_block_N (const u32 *in0, const u32 *in1, u32 *out0, u32 *out1, const u32 num)
|
|
|
|
|
{
|
|
|
|
|
switch (num)
|
|
|
|
|
{
|
|
|
|
@ -750,7 +750,7 @@ void rshift_block_N (const u32 *in0, const u32 *in1, u32 *out0, u32 *out1, const
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void append_block1 (const u32 offset, u32 *buf0, u32 *buf1, const u32 src_r0)
|
|
|
|
|
DECLSPEC void append_block1 (const u32 offset, u32 *buf0, u32 *buf1, const u32 src_r0)
|
|
|
|
|
{
|
|
|
|
|
// this version works with 1 byte append only
|
|
|
|
|
const u32 value = src_r0 & 0xff;
|
|
|
|
@ -768,10 +768,9 @@ void append_block1 (const u32 offset, u32 *buf0, u32 *buf1, const u32 src_r0)
|
|
|
|
|
|
|
|
|
|
append_helper_1x4_S (buf0, ((offset16 == 0) ? tmp : 0), v);
|
|
|
|
|
append_helper_1x4_S (buf1, ((offset16 == 1) ? tmp : 0), v);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void append_block8 (const u32 offset, u32 *buf0, u32 *buf1, const u32 *src_l0, const u32 *src_l1, const u32 *src_r0, const u32 *src_r1)
|
|
|
|
|
DECLSPEC void append_block8 (const u32 offset, u32 *buf0, u32 *buf1, const u32 *src_l0, const u32 *src_l1, const u32 *src_r0, const u32 *src_r1)
|
|
|
|
|
{
|
|
|
|
|
u32 s0 = 0;
|
|
|
|
|
u32 s1 = 0;
|
|
|
|
@ -1026,7 +1025,7 @@ void append_block8 (const u32 offset, u32 *buf0, u32 *buf1, const u32 *src_l0, c
|
|
|
|
|
buf1[3] = src_l1[3] | s7;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void reverse_block (u32 *in0, u32 *in1, u32 *out0, u32 *out1, const u32 len)
|
|
|
|
|
DECLSPEC void reverse_block (u32 *in0, u32 *in1, u32 *out0, u32 *out1, const u32 len)
|
|
|
|
|
{
|
|
|
|
|
rshift_block_N (in0, in1, out0, out1, 32 - len);
|
|
|
|
|
|
|
|
|
@ -1052,7 +1051,7 @@ void reverse_block (u32 *in0, u32 *in1, u32 *out0, u32 *out1, const u32 len)
|
|
|
|
|
out1[3] = swap32_S (tib41[3]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void exchange_byte (u32 *buf, const int off_src, const int off_dst)
|
|
|
|
|
DECLSPEC void exchange_byte (u32 *buf, const int off_src, const int off_dst)
|
|
|
|
|
{
|
|
|
|
|
u8 *ptr = (u8 *) buf;
|
|
|
|
|
|
|
|
|
@ -1062,7 +1061,7 @@ void exchange_byte (u32 *buf, const int off_src, const int off_dst)
|
|
|
|
|
ptr[off_dst] = tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 rule_op_mangle_lrest (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
DECLSPEC u32 rule_op_mangle_lrest (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
{
|
|
|
|
|
u32 t;
|
|
|
|
|
|
|
|
|
@ -1078,7 +1077,7 @@ u32 rule_op_mangle_lrest (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1,
|
|
|
|
|
return in_len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 rule_op_mangle_urest (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
DECLSPEC u32 rule_op_mangle_urest (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
{
|
|
|
|
|
u32 t;
|
|
|
|
|
|
|
|
|
@ -1094,7 +1093,7 @@ u32 rule_op_mangle_urest (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1,
|
|
|
|
|
return in_len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 rule_op_mangle_lrest_ufirst (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
DECLSPEC u32 rule_op_mangle_lrest_ufirst (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
{
|
|
|
|
|
u32 t;
|
|
|
|
|
|
|
|
|
@ -1112,7 +1111,7 @@ u32 rule_op_mangle_lrest_ufirst (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u
|
|
|
|
|
return in_len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 rule_op_mangle_urest_lfirst (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
DECLSPEC u32 rule_op_mangle_urest_lfirst (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
{
|
|
|
|
|
u32 t;
|
|
|
|
|
|
|
|
|
@ -1130,7 +1129,7 @@ u32 rule_op_mangle_urest_lfirst (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u
|
|
|
|
|
return in_len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 rule_op_mangle_trest (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
DECLSPEC u32 rule_op_mangle_trest (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
{
|
|
|
|
|
u32 t;
|
|
|
|
|
|
|
|
|
@ -1146,7 +1145,7 @@ u32 rule_op_mangle_trest (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1,
|
|
|
|
|
return in_len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 rule_op_mangle_toggle_at (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
DECLSPEC u32 rule_op_mangle_toggle_at (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
{
|
|
|
|
|
if (p0 >= in_len) return in_len;
|
|
|
|
|
|
|
|
|
@ -1179,14 +1178,14 @@ u32 rule_op_mangle_toggle_at (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32
|
|
|
|
|
return (in_len);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 rule_op_mangle_reverse (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
DECLSPEC u32 rule_op_mangle_reverse (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
{
|
|
|
|
|
reverse_block (buf0, buf1, buf0, buf1, in_len);
|
|
|
|
|
|
|
|
|
|
return in_len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 rule_op_mangle_dupeword (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
DECLSPEC u32 rule_op_mangle_dupeword (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
{
|
|
|
|
|
if ((in_len + in_len) >= 32) return in_len;
|
|
|
|
|
|
|
|
|
@ -1199,7 +1198,7 @@ u32 rule_op_mangle_dupeword (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p
|
|
|
|
|
return out_len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 rule_op_mangle_dupeword_times (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
DECLSPEC u32 rule_op_mangle_dupeword_times (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
{
|
|
|
|
|
if (((in_len * p0) + in_len) >= 32) return in_len;
|
|
|
|
|
|
|
|
|
@ -1227,7 +1226,7 @@ u32 rule_op_mangle_dupeword_times (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const
|
|
|
|
|
return out_len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 rule_op_mangle_reflect (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
DECLSPEC u32 rule_op_mangle_reflect (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
{
|
|
|
|
|
if ((in_len + in_len) >= 32) return in_len;
|
|
|
|
|
|
|
|
|
@ -1245,7 +1244,7 @@ u32 rule_op_mangle_reflect (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1
|
|
|
|
|
return out_len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 rule_op_mangle_append (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
DECLSPEC u32 rule_op_mangle_append (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
{
|
|
|
|
|
if ((in_len + 1) >= 32) return in_len;
|
|
|
|
|
|
|
|
|
@ -1258,7 +1257,7 @@ u32 rule_op_mangle_append (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1,
|
|
|
|
|
return out_len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 rule_op_mangle_prepend (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
DECLSPEC u32 rule_op_mangle_prepend (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
{
|
|
|
|
|
if ((in_len + 1) >= 32) return in_len;
|
|
|
|
|
|
|
|
|
@ -1273,7 +1272,7 @@ u32 rule_op_mangle_prepend (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1
|
|
|
|
|
return out_len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 rule_op_mangle_rotate_left (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
DECLSPEC u32 rule_op_mangle_rotate_left (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
{
|
|
|
|
|
if (in_len == 0) return in_len;
|
|
|
|
|
|
|
|
|
@ -1288,7 +1287,7 @@ u32 rule_op_mangle_rotate_left (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u3
|
|
|
|
|
return in_len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 rule_op_mangle_rotate_right (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
DECLSPEC u32 rule_op_mangle_rotate_right (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
{
|
|
|
|
|
if (in_len == 0) return in_len;
|
|
|
|
|
|
|
|
|
@ -1330,7 +1329,7 @@ u32 rule_op_mangle_rotate_right (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u
|
|
|
|
|
return in_len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 rule_op_mangle_delete_first (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
DECLSPEC u32 rule_op_mangle_delete_first (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
{
|
|
|
|
|
if (in_len == 0) return in_len;
|
|
|
|
|
|
|
|
|
@ -1341,7 +1340,7 @@ u32 rule_op_mangle_delete_first (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u
|
|
|
|
|
return in_len1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 rule_op_mangle_delete_last (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
DECLSPEC u32 rule_op_mangle_delete_last (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
{
|
|
|
|
|
if (in_len == 0) return in_len;
|
|
|
|
|
|
|
|
|
@ -1361,7 +1360,7 @@ u32 rule_op_mangle_delete_last (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u3
|
|
|
|
|
return in_len1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 rule_op_mangle_delete_at (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
DECLSPEC u32 rule_op_mangle_delete_at (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
{
|
|
|
|
|
if (p0 >= in_len) return in_len;
|
|
|
|
|
|
|
|
|
@ -1442,7 +1441,7 @@ u32 rule_op_mangle_delete_at (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32
|
|
|
|
|
return out_len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 rule_op_mangle_extract (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
DECLSPEC u32 rule_op_mangle_extract (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
{
|
|
|
|
|
if (p0 >= in_len) return in_len;
|
|
|
|
|
|
|
|
|
@ -1457,7 +1456,7 @@ u32 rule_op_mangle_extract (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1
|
|
|
|
|
return out_len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 rule_op_mangle_omit (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
DECLSPEC u32 rule_op_mangle_omit (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
{
|
|
|
|
|
if (p0 >= in_len) return in_len;
|
|
|
|
|
|
|
|
|
@ -1549,7 +1548,7 @@ u32 rule_op_mangle_omit (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, M
|
|
|
|
|
return out_len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 rule_op_mangle_insert (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
DECLSPEC u32 rule_op_mangle_insert (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
{
|
|
|
|
|
if (p0 > in_len) return in_len;
|
|
|
|
|
|
|
|
|
@ -1627,7 +1626,7 @@ u32 rule_op_mangle_insert (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1,
|
|
|
|
|
return out_len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 rule_op_mangle_overstrike (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
DECLSPEC u32 rule_op_mangle_overstrike (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
{
|
|
|
|
|
if (p0 >= in_len) return in_len;
|
|
|
|
|
|
|
|
|
@ -1662,7 +1661,7 @@ u32 rule_op_mangle_overstrike (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32
|
|
|
|
|
return in_len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 rule_op_mangle_truncate_at (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
DECLSPEC u32 rule_op_mangle_truncate_at (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
{
|
|
|
|
|
if (p0 >= in_len) return in_len;
|
|
|
|
|
|
|
|
|
@ -1671,7 +1670,7 @@ u32 rule_op_mangle_truncate_at (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u3
|
|
|
|
|
return p0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 search_on_register (const u32 in, const u32 p0)
|
|
|
|
|
DECLSPEC u32 search_on_register (const u32 in, const u32 p0)
|
|
|
|
|
{
|
|
|
|
|
u32 r = 0;
|
|
|
|
|
|
|
|
|
@ -1683,7 +1682,7 @@ u32 search_on_register (const u32 in, const u32 p0)
|
|
|
|
|
return r;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 replace_on_register (const u32 in, const u32 r, const u32 p1)
|
|
|
|
|
DECLSPEC u32 replace_on_register (const u32 in, const u32 r, const u32 p1)
|
|
|
|
|
{
|
|
|
|
|
u32 out = in;
|
|
|
|
|
|
|
|
|
@ -1695,7 +1694,7 @@ u32 replace_on_register (const u32 in, const u32 r, const u32 p1)
|
|
|
|
|
return out;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 rule_op_mangle_replace (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
DECLSPEC u32 rule_op_mangle_replace (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
{
|
|
|
|
|
const u32 r0 = search_on_register (buf0[0], p0);
|
|
|
|
|
const u32 r1 = search_on_register (buf0[1], p0);
|
|
|
|
@ -1722,7 +1721,7 @@ u32 rule_op_mangle_replace (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1
|
|
|
|
|
return in_len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 rule_op_mangle_purgechar (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
DECLSPEC u32 rule_op_mangle_purgechar (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
{
|
|
|
|
|
const u32 r0 = search_on_register (buf0[0], p0);
|
|
|
|
|
const u32 r1 = search_on_register (buf0[1], p0);
|
|
|
|
@ -1776,7 +1775,7 @@ u32 rule_op_mangle_purgechar (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32
|
|
|
|
|
return out_len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 rule_op_mangle_dupechar_first (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
DECLSPEC u32 rule_op_mangle_dupechar_first (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
{
|
|
|
|
|
if ( in_len == 0) return in_len;
|
|
|
|
|
if ((in_len + p0) >= 32) return in_len;
|
|
|
|
@ -1811,7 +1810,7 @@ u32 rule_op_mangle_dupechar_first (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const
|
|
|
|
|
return out_len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 rule_op_mangle_dupechar_last (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
DECLSPEC u32 rule_op_mangle_dupechar_last (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
{
|
|
|
|
|
if ( in_len == 0) return in_len;
|
|
|
|
|
if ((in_len + p0) >= 32) return in_len;
|
|
|
|
@ -1857,7 +1856,7 @@ u32 rule_op_mangle_dupechar_last (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const
|
|
|
|
|
return out_len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 rule_op_mangle_dupechar_all (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
DECLSPEC u32 rule_op_mangle_dupechar_all (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
{
|
|
|
|
|
if ( in_len == 0) return in_len;
|
|
|
|
|
if ((in_len + in_len) >= 32) return in_len;
|
|
|
|
@ -1890,7 +1889,7 @@ u32 rule_op_mangle_dupechar_all (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u
|
|
|
|
|
return out_len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 rule_op_mangle_switch_first (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
DECLSPEC u32 rule_op_mangle_switch_first (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
{
|
|
|
|
|
if (in_len < 2) return in_len;
|
|
|
|
|
|
|
|
|
@ -1899,7 +1898,7 @@ u32 rule_op_mangle_switch_first (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u
|
|
|
|
|
return in_len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 rule_op_mangle_switch_last (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
DECLSPEC u32 rule_op_mangle_switch_last (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
{
|
|
|
|
|
if (in_len < 2) return in_len;
|
|
|
|
|
|
|
|
|
@ -1928,7 +1927,7 @@ u32 rule_op_mangle_switch_last (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u3
|
|
|
|
|
return in_len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 rule_op_mangle_switch_at (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
DECLSPEC u32 rule_op_mangle_switch_at (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
{
|
|
|
|
|
if (p0 >= in_len) return in_len;
|
|
|
|
|
if (p1 >= in_len) return in_len;
|
|
|
|
@ -1958,7 +1957,7 @@ u32 rule_op_mangle_switch_at (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32
|
|
|
|
|
return in_len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 rule_op_mangle_chr_shiftl (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
DECLSPEC u32 rule_op_mangle_chr_shiftl (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
{
|
|
|
|
|
if (p0 >= in_len) return in_len;
|
|
|
|
|
|
|
|
|
@ -1992,7 +1991,7 @@ u32 rule_op_mangle_chr_shiftl (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32
|
|
|
|
|
return in_len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 rule_op_mangle_chr_shiftr (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
DECLSPEC u32 rule_op_mangle_chr_shiftr (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
{
|
|
|
|
|
if (p0 >= in_len) return in_len;
|
|
|
|
|
|
|
|
|
@ -2026,7 +2025,7 @@ u32 rule_op_mangle_chr_shiftr (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32
|
|
|
|
|
return in_len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 rule_op_mangle_chr_incr (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
DECLSPEC u32 rule_op_mangle_chr_incr (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
{
|
|
|
|
|
if (p0 >= in_len) return in_len;
|
|
|
|
|
|
|
|
|
@ -2062,7 +2061,7 @@ u32 rule_op_mangle_chr_incr (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p
|
|
|
|
|
return in_len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 rule_op_mangle_chr_decr (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
DECLSPEC u32 rule_op_mangle_chr_decr (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
{
|
|
|
|
|
if (p0 >= in_len) return in_len;
|
|
|
|
|
|
|
|
|
@ -2098,7 +2097,7 @@ u32 rule_op_mangle_chr_decr (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p
|
|
|
|
|
return in_len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 rule_op_mangle_replace_np1 (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
DECLSPEC u32 rule_op_mangle_replace_np1 (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
{
|
|
|
|
|
if ((p0 + 1) >= in_len) return in_len;
|
|
|
|
|
|
|
|
|
@ -2138,7 +2137,7 @@ u32 rule_op_mangle_replace_np1 (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u3
|
|
|
|
|
return in_len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 rule_op_mangle_replace_nm1 (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
DECLSPEC u32 rule_op_mangle_replace_nm1 (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
{
|
|
|
|
|
if (p0 == 0) return in_len;
|
|
|
|
|
|
|
|
|
@ -2180,7 +2179,7 @@ u32 rule_op_mangle_replace_nm1 (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u3
|
|
|
|
|
return in_len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 rule_op_mangle_dupeblock_first (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
DECLSPEC u32 rule_op_mangle_dupeblock_first (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
{
|
|
|
|
|
if (p0 > in_len) return in_len;
|
|
|
|
|
|
|
|
|
@ -2218,7 +2217,7 @@ u32 rule_op_mangle_dupeblock_first (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED cons
|
|
|
|
|
return out_len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 rule_op_mangle_dupeblock_last (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
DECLSPEC u32 rule_op_mangle_dupeblock_last (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
{
|
|
|
|
|
if (p0 > in_len) return in_len;
|
|
|
|
|
|
|
|
|
@ -2247,7 +2246,7 @@ u32 rule_op_mangle_dupeblock_last (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const
|
|
|
|
|
return out_len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 toggle_on_register (const u32 in, const u32 r)
|
|
|
|
|
DECLSPEC u32 toggle_on_register (const u32 in, const u32 r)
|
|
|
|
|
{
|
|
|
|
|
u32 out = in;
|
|
|
|
|
|
|
|
|
@ -2261,7 +2260,7 @@ u32 toggle_on_register (const u32 in, const u32 r)
|
|
|
|
|
return out;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 rule_op_mangle_title_sep (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
DECLSPEC u32 rule_op_mangle_title_sep (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32 p1, MAYBE_UNUSED u32 *buf0, MAYBE_UNUSED u32 *buf1, const u32 in_len)
|
|
|
|
|
{
|
|
|
|
|
if (in_len == 0) return in_len;
|
|
|
|
|
|
|
|
|
@ -2301,7 +2300,7 @@ u32 rule_op_mangle_title_sep (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED const u32
|
|
|
|
|
return in_len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 apply_rule (const u32 name, const u32 p0, const u32 p1, u32 *buf0, u32 *buf1, const u32 in_len)
|
|
|
|
|
DECLSPEC u32 apply_rule (const u32 name, const u32 p0, const u32 p1, u32 *buf0, u32 *buf1, const u32 in_len)
|
|
|
|
|
{
|
|
|
|
|
u32 out_len = in_len;
|
|
|
|
|
|
|
|
|
@ -2353,7 +2352,7 @@ u32 apply_rule (const u32 name, const u32 p0, const u32 p1, u32 *buf0, u32 *buf1
|
|
|
|
|
return out_len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 apply_rules (__constant const u32 *cmds, u32 *buf0, u32 *buf1, const u32 len)
|
|
|
|
|
DECLSPEC u32 apply_rules (__constant const u32 *cmds, u32 *buf0, u32 *buf1, const u32 len)
|
|
|
|
|
{
|
|
|
|
|
u32 out_len = len;
|
|
|
|
|
|
|
|
|
@ -2371,7 +2370,7 @@ u32 apply_rules (__constant const u32 *cmds, u32 *buf0, u32 *buf1, const u32 len
|
|
|
|
|
return out_len;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32x apply_rules_vect (const u32 *pw_buf0, const u32 *pw_buf1, const u32 pw_len, __constant const kernel_rule_t *rules_buf, const u32 il_pos, u32x *buf0, u32x *buf1)
|
|
|
|
|
DECLSPEC u32x apply_rules_vect (const u32 *pw_buf0, const u32 *pw_buf1, const u32 pw_len, __constant const kernel_rule_t *rules_buf, const u32 il_pos, u32x *buf0, u32x *buf1)
|
|
|
|
|
{
|
|
|
|
|
#if VECT_SIZE == 1
|
|
|
|
|
|
|
|
|
|