mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
fix cStyleCasts
This commit is contained in:
parent
a8373df48b
commit
e111684bc2
@ -74,9 +74,9 @@ void dumpLitIndex(const FDRConfirm *fdrc, FILE *f) {
|
|||||||
static
|
static
|
||||||
void dumpConfirms(const void *fdr_base, u32 conf_offset, u32 num_confirms,
|
void dumpConfirms(const void *fdr_base, u32 conf_offset, u32 num_confirms,
|
||||||
FILE *f) {
|
FILE *f) {
|
||||||
const u32 *conf = (const u32 *)((const char *)fdr_base + conf_offset);
|
const u32 *conf = reinterpret_cast<const u32 *>(reinterpret_cast<const char *>(fdr_base) + conf_offset);
|
||||||
for (u32 i = 0; i < num_confirms; i++) {
|
for (u32 i = 0; i < num_confirms; i++) {
|
||||||
const auto *fdrc = (const FDRConfirm *)((const char *)conf + conf[i]);
|
const auto *fdrc = reinterpret_cast<const FDRConfirm *>(reinterpret_cast<const char *>(conf) + conf[i]);
|
||||||
fprintf(f, " confirm %u\n", i);
|
fprintf(f, " confirm %u\n", i);
|
||||||
fprintf(f, " andmsk 0x%016llx\n", fdrc->andmsk);
|
fprintf(f, " andmsk 0x%016llx\n", fdrc->andmsk);
|
||||||
fprintf(f, " mult 0x%016llx\n", fdrc->mult);
|
fprintf(f, " mult 0x%016llx\n", fdrc->mult);
|
||||||
@ -157,7 +157,7 @@ void dumpTeddy(const Teddy *teddy, FILE *f) {
|
|||||||
fprintf(f, " buckets %u\n", des->getNumBuckets());
|
fprintf(f, " buckets %u\n", des->getNumBuckets());
|
||||||
fprintf(f, " packed %s\n", des->packed ? "true" : "false");
|
fprintf(f, " packed %s\n", des->packed ? "true" : "false");
|
||||||
fprintf(f, " strings %u\n", teddy->numStrings);
|
fprintf(f, " strings %u\n", teddy->numStrings);
|
||||||
fprintf(f, " size %zu bytes\n", fdrSize((const FDR *)teddy));
|
fprintf(f, " size %zu bytes\n", fdrSize(reinterpret_cast<const FDR *>(teddy)));
|
||||||
fprintf(f, " max length %u\n", teddy->maxStringLen);
|
fprintf(f, " max length %u\n", teddy->maxStringLen);
|
||||||
fprintf(f, " floodoff %u (%x)\n", teddy->floodOffset,
|
fprintf(f, " floodoff %u (%x)\n", teddy->floodOffset,
|
||||||
teddy->floodOffset);
|
teddy->floodOffset);
|
||||||
@ -165,7 +165,7 @@ void dumpTeddy(const Teddy *teddy, FILE *f) {
|
|||||||
|
|
||||||
u32 maskWidth = des->getNumBuckets() / 8;
|
u32 maskWidth = des->getNumBuckets() / 8;
|
||||||
size_t headerSize = sizeof(Teddy);
|
size_t headerSize = sizeof(Teddy);
|
||||||
const u8 *teddy_base = (const u8 *)teddy;
|
const u8 *teddy_base = reinterpret_cast<const u8 *>(teddy);
|
||||||
const u8 *baseMsk = teddy_base + ROUNDUP_CL(headerSize);
|
const u8 *baseMsk = teddy_base + ROUNDUP_CL(headerSize);
|
||||||
dumpTeddyMasks(baseMsk, des->numMasks, maskWidth, f);
|
dumpTeddyMasks(baseMsk, des->numMasks, maskWidth, f);
|
||||||
size_t maskLen = des->numMasks * 16 * 2 * maskWidth;
|
size_t maskLen = des->numMasks * 16 * 2 * maskWidth;
|
||||||
@ -201,7 +201,7 @@ void dumpFDR(const FDR *fdr, FILE *f) {
|
|||||||
|
|
||||||
void fdrPrintStats(const FDR *fdr, FILE *f) {
|
void fdrPrintStats(const FDR *fdr, FILE *f) {
|
||||||
if (fdrIsTeddy(fdr)) {
|
if (fdrIsTeddy(fdr)) {
|
||||||
dumpTeddy((const Teddy *)fdr, f);
|
dumpTeddy(reinterpret_cast<const Teddy *>(fdr), f);
|
||||||
} else {
|
} else {
|
||||||
dumpFDR(fdr, f);
|
dumpFDR(fdr, f);
|
||||||
}
|
}
|
||||||
|
@ -53,10 +53,10 @@ void hwlmGenerateDumpFiles(const HWLM *h, const string &base) {
|
|||||||
|
|
||||||
switch (h->type) {
|
switch (h->type) {
|
||||||
case HWLM_ENGINE_NOOD:
|
case HWLM_ENGINE_NOOD:
|
||||||
noodPrintStats((const noodTable *)HWLM_C_DATA(h), f);
|
noodPrintStats(reinterpret_cast<const noodTable *>(HWLM_C_DATA(h)), f);
|
||||||
break;
|
break;
|
||||||
case HWLM_ENGINE_FDR:
|
case HWLM_ENGINE_FDR:
|
||||||
fdrPrintStats((const FDR *)HWLM_C_DATA(h), f);
|
fdrPrintStats(reinterpret_cast<const FDR *>(HWLM_C_DATA(h)), f);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(f, "<unknown hwlm subengine>\n");
|
fprintf(f, "<unknown hwlm subengine>\n");
|
||||||
|
@ -156,7 +156,7 @@ void noodPrintStats(const noodTable *n, FILE *f) {
|
|||||||
n->msk_len);
|
n->msk_len);
|
||||||
fprintf(f, "String: ");
|
fprintf(f, "String: ");
|
||||||
for (u32 i = 0; i < n->msk_len; i++) {
|
for (u32 i = 0; i < n->msk_len; i++) {
|
||||||
const u8 *m = (const u8 *)&n->cmp;
|
const u8 *m = reinterpret_cast<const u8 *>(&n->cmp);
|
||||||
if (isgraph(m[i]) && m[i] != '\\') {
|
if (isgraph(m[i]) && m[i] != '\\') {
|
||||||
fprintf(f, "%c", m[i]);
|
fprintf(f, "%c", m[i]);
|
||||||
} else {
|
} else {
|
||||||
|
@ -210,31 +210,31 @@ void dumpAccelInfo(FILE *f, const AccelAux &accel) {
|
|||||||
break;
|
break;
|
||||||
case ACCEL_SHUFTI: {
|
case ACCEL_SHUFTI: {
|
||||||
fprintf(f, "\n");
|
fprintf(f, "\n");
|
||||||
dumpShuftiMasks(f, (const u8 *)&accel.shufti.lo,
|
dumpShuftiMasks(f, reinterpret_cast<const u8 *>(&accel.shufti.lo),
|
||||||
(const u8 *)&accel.shufti.hi);
|
reinterpret_cast<const u8 *>(&accel.shufti.hi));
|
||||||
dumpShuftiCharReach(f, (const u8 *)&accel.shufti.lo,
|
dumpShuftiCharReach(f, reinterpret_cast<const u8 *>(&accel.shufti.lo),
|
||||||
(const u8 *)&accel.shufti.hi);
|
reinterpret_cast<const u8 *>(&accel.shufti.hi));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ACCEL_DSHUFTI:
|
case ACCEL_DSHUFTI:
|
||||||
fprintf(f, "\n");
|
fprintf(f, "\n");
|
||||||
fprintf(f, "mask 1\n");
|
fprintf(f, "mask 1\n");
|
||||||
dumpShuftiMasks(f, (const u8 *)&accel.dshufti.lo1,
|
dumpShuftiMasks(f, reinterpret_cast<const u8 *>(&accel.dshufti.lo1),
|
||||||
(const u8 *)&accel.dshufti.hi1);
|
reinterpret_cast<const u8 *>(&accel.dshufti.hi1));
|
||||||
fprintf(f, "mask 2\n");
|
fprintf(f, "mask 2\n");
|
||||||
dumpShuftiMasks(f, (const u8 *)&accel.dshufti.lo2,
|
dumpShuftiMasks(f, reinterpret_cast<const u8 *>(&accel.dshufti.lo2),
|
||||||
(const u8 *)&accel.dshufti.hi2);
|
reinterpret_cast<const u8 *>(&accel.dshufti.hi2));
|
||||||
dumpDShuftiCharReach(f, (const u8 *)&accel.dshufti.lo1,
|
dumpDShuftiCharReach(f, reinterpret_cast<const u8 *>(&accel.dshufti.lo1),
|
||||||
(const u8 *)&accel.dshufti.hi1,
|
reinterpret_cast<const u8 *>(&accel.dshufti.hi1),
|
||||||
(const u8 *)&accel.dshufti.lo2,
|
reinterpret_cast<const u8 *>(&accel.dshufti.lo2),
|
||||||
(const u8 *)&accel.dshufti.hi2);
|
reinterpret_cast<const u8 *>(&accel.dshufti.hi2));
|
||||||
break;
|
break;
|
||||||
case ACCEL_TRUFFLE: {
|
case ACCEL_TRUFFLE: {
|
||||||
fprintf(f, "\n");
|
fprintf(f, "\n");
|
||||||
dumpTruffleMasks(f, (const u8 *)&accel.truffle.mask1,
|
dumpTruffleMasks(f, reinterpret_cast<const u8 *>(&accel.truffle.mask1),
|
||||||
(const u8 *)&accel.truffle.mask2);
|
reinterpret_cast<const u8 *>(&accel.truffle.mask2));
|
||||||
dumpTruffleCharReach(f, (const u8 *)&accel.truffle.mask1,
|
dumpTruffleCharReach(f, reinterpret_cast<const u8 *>(&accel.truffle.mask1),
|
||||||
(const u8 *)&accel.truffle.mask2);
|
reinterpret_cast<const u8 *>(&accel.truffle.mask2));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -56,7 +56,7 @@ namespace ue2 {
|
|||||||
static
|
static
|
||||||
void dumpTextSubCastle(const SubCastle &sub, FILE *f) {
|
void dumpTextSubCastle(const SubCastle &sub, FILE *f) {
|
||||||
const RepeatInfo *info =
|
const RepeatInfo *info =
|
||||||
(const RepeatInfo *)((const char *)&sub + sub.repeatInfoOffset);
|
reinterpret_cast<const RepeatInfo *>(reinterpret_cast<const char *>(&sub) + sub.repeatInfoOffset);
|
||||||
fprintf(f, " repeat model: %s\n", repeatTypeName(info->type));
|
fprintf(f, " repeat model: %s\n", repeatTypeName(info->type));
|
||||||
fprintf(f, " repeat bounds: {%u, %u}\n", info->repeatMin,
|
fprintf(f, " repeat bounds: {%u, %u}\n", info->repeatMin,
|
||||||
info->repeatMax);
|
info->repeatMax);
|
||||||
@ -69,7 +69,7 @@ void dumpTextSubCastle(const SubCastle &sub, FILE *f) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void nfaExecCastle_dump(const struct NFA *nfa, const string &base) {
|
void nfaExecCastle_dump(const struct NFA *nfa, const string &base) {
|
||||||
const Castle *c = (const Castle *)getImplNfa(nfa);
|
const Castle *c = reinterpret_cast<const Castle *>(getImplNfa(nfa));
|
||||||
|
|
||||||
StdioFile f(base + ".txt", "w");
|
StdioFile f(base + ".txt", "w");
|
||||||
|
|
||||||
@ -88,15 +88,15 @@ void nfaExecCastle_dump(const struct NFA *nfa, const string &base) {
|
|||||||
fprintf(f, "negated verm, scanning for 0x%02x\n", c->u.verm.c);
|
fprintf(f, "negated verm, scanning for 0x%02x\n", c->u.verm.c);
|
||||||
break;
|
break;
|
||||||
case CASTLE_SHUFTI: {
|
case CASTLE_SHUFTI: {
|
||||||
const CharReach cr = shufti2cr((const u8 *)&c->u.shuf.mask_lo,
|
const CharReach cr = shufti2cr(reinterpret_cast<const u8 *>(&c->u.shuf.mask_lo),
|
||||||
(const u8 *)&c->u.shuf.mask_hi);
|
reinterpret_cast<const u8 *>(&c->u.shuf.mask_hi));
|
||||||
fprintf(f, "shufti, scanning for %s (%zu chars)\n",
|
fprintf(f, "shufti, scanning for %s (%zu chars)\n",
|
||||||
describeClass(cr).c_str(), cr.count());
|
describeClass(cr).c_str(), cr.count());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CASTLE_TRUFFLE: {
|
case CASTLE_TRUFFLE: {
|
||||||
const CharReach cr = truffle2cr((const u8 *)&c->u.truffle.mask1,
|
const CharReach cr = truffle2cr(reinterpret_cast<const u8 *>(&c->u.truffle.mask1),
|
||||||
(const u8 *)&c->u.truffle.mask2);
|
reinterpret_cast<const u8 *>(&c->u.truffle.mask2));
|
||||||
fprintf(f, "truffle, scanning for %s (%zu chars)\n",
|
fprintf(f, "truffle, scanning for %s (%zu chars)\n",
|
||||||
describeClass(cr).c_str(), cr.count());
|
describeClass(cr).c_str(), cr.count());
|
||||||
break;
|
break;
|
||||||
@ -112,7 +112,7 @@ void nfaExecCastle_dump(const struct NFA *nfa, const string &base) {
|
|||||||
fprintf(f, "\n");
|
fprintf(f, "\n");
|
||||||
|
|
||||||
const SubCastle *sub =
|
const SubCastle *sub =
|
||||||
(const SubCastle *)((const char *)c + sizeof(Castle));
|
reinterpret_cast<const SubCastle *>(reinterpret_cast<const char *>(c) + sizeof(Castle));
|
||||||
for (u32 i = 0; i < c->numRepeats; i++) {
|
for (u32 i = 0; i < c->numRepeats; i++) {
|
||||||
fprintf(f, "Sub %u:\n", i);
|
fprintf(f, "Sub %u:\n", i);
|
||||||
dumpTextSubCastle(sub[i], f);
|
dumpTextSubCastle(sub[i], f);
|
||||||
|
@ -59,14 +59,14 @@ namespace ue2 {
|
|||||||
static
|
static
|
||||||
void goughGetTransitions(const NFA *n, u16 s, u16 *t) {
|
void goughGetTransitions(const NFA *n, u16 s, u16 *t) {
|
||||||
assert(isGoughType(n->type));
|
assert(isGoughType(n->type));
|
||||||
const mcclellan *m = (const mcclellan *)getImplNfa(n);
|
const mcclellan *m = reinterpret_cast<const mcclellan *>(getImplNfa(n));
|
||||||
const mstate_aux *aux = getAux(n, s);
|
const mstate_aux *aux = getAux(n, s);
|
||||||
const u32 as = m->alphaShift;
|
const u32 as = m->alphaShift;
|
||||||
const char *sher_base
|
const char *sher_base
|
||||||
= (const char *)m - sizeof(struct NFA) + m->sherman_offset;
|
= reinterpret_cast<const char *>(m) - sizeof(struct NFA) + m->sherman_offset;
|
||||||
|
|
||||||
if (n->type == GOUGH_NFA_8) {
|
if (n->type == GOUGH_NFA_8) {
|
||||||
const u8 *succ_table = (const u8 *)((const char *)m + sizeof(mcclellan));
|
const u8 *succ_table = reinterpret_cast<const u8 *>(reinterpret_cast<const char *>(m) + sizeof(mcclellan));
|
||||||
for (u16 c = 0; c < N_CHARS; c++) {
|
for (u16 c = 0; c < N_CHARS; c++) {
|
||||||
t[c] = succ_table[((u32)s << as) + m->remap[c]];
|
t[c] = succ_table[((u32)s << as) + m->remap[c]];
|
||||||
}
|
}
|
||||||
@ -76,14 +76,14 @@ void goughGetTransitions(const NFA *n, u16 s, u16 *t) {
|
|||||||
if (s >= m->sherman_limit) {
|
if (s >= m->sherman_limit) {
|
||||||
const char *state_base
|
const char *state_base
|
||||||
= findShermanState(m, sher_base, m->sherman_limit, s);
|
= findShermanState(m, sher_base, m->sherman_limit, s);
|
||||||
base_s = *(const u16 *)(state_base + SHERMAN_DADDY_OFFSET);
|
base_s = *(reinterpret_cast<const u16 *>(state_base + SHERMAN_DADDY_OFFSET));
|
||||||
}
|
}
|
||||||
|
|
||||||
const u16 *succ_table = (const u16 *)((const char *)m
|
const u16 *succ_table = reinterpret_cast<const u16 *>(reinterpret_cast<const char *>(m)
|
||||||
+ sizeof(mcclellan));
|
+ sizeof(mcclellan));
|
||||||
for (u16 c = 0; c < N_CHARS; c++) {
|
for (u16 c = 0; c < N_CHARS; c++) {
|
||||||
const u8 *addr
|
const u8 *addr
|
||||||
= (const u8*)(succ_table + (((u32)base_s << as) + m->remap[c]));
|
= reinterpret_cast<const u8*>(succ_table + (((u32)base_s << as) + m->remap[c]));
|
||||||
t[c] = unaligned_load_u16(addr);
|
t[c] = unaligned_load_u16(addr);
|
||||||
t[c] &= STATE_MASK;
|
t[c] &= STATE_MASK;
|
||||||
}
|
}
|
||||||
@ -91,15 +91,15 @@ void goughGetTransitions(const NFA *n, u16 s, u16 *t) {
|
|||||||
if (s >= m->sherman_limit) {
|
if (s >= m->sherman_limit) {
|
||||||
const char *state_base
|
const char *state_base
|
||||||
= findShermanState(m, sher_base, m->sherman_limit, s);
|
= findShermanState(m, sher_base, m->sherman_limit, s);
|
||||||
u8 len = *(const u8 *)(SHERMAN_LEN_OFFSET + state_base);
|
u8 len = *(reinterpret_cast<const u8 *>(SHERMAN_LEN_OFFSET + state_base));
|
||||||
const u8 *chars = (const u8 *)state_base + SHERMAN_CHARS_OFFSET;
|
const u8 *chars = reinterpret_cast<const u8 *>(state_base) + SHERMAN_CHARS_OFFSET;
|
||||||
const u16 *states
|
const u16 *states
|
||||||
= (const u16 *)(state_base + SHERMAN_STATES_OFFSET(len));
|
= reinterpret_cast<const u16 *>(state_base + SHERMAN_STATES_OFFSET(len));
|
||||||
|
|
||||||
for (u8 i = 0; i < len; i++) {
|
for (u8 i = 0; i < len; i++) {
|
||||||
for (u16 c = 0; c < N_CHARS; c++) {
|
for (u16 c = 0; c < N_CHARS; c++) {
|
||||||
if (m->remap[c] != chars[i]) {
|
if (m->remap[c] != chars[i]) {
|
||||||
t[c] = unaligned_load_u16((const u8*)&states[i])
|
t[c] = unaligned_load_u16(reinterpret_cast<const u8*>(&states[i]))
|
||||||
& STATE_MASK;
|
& STATE_MASK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -116,14 +116,14 @@ void describeNode(const NFA *n, const mcclellan *m, u16 i, FILE *f) {
|
|||||||
|
|
||||||
bool isSherman = m->sherman_limit && i >= m->sherman_limit;
|
bool isSherman = m->sherman_limit && i >= m->sherman_limit;
|
||||||
const char *sher_base
|
const char *sher_base
|
||||||
= (const char *)m - sizeof(NFA) + m->sherman_offset;
|
= reinterpret_cast<const char *>(m) - sizeof(NFA) + m->sherman_offset;
|
||||||
|
|
||||||
fprintf(f, "%u [ width = 1, fixedsize = true, fontsize = 12, "
|
fprintf(f, "%u [ width = 1, fixedsize = true, fontsize = 12, "
|
||||||
"label = \"%u%s\" ]; \n", i, i, isSherman ? "w":"");
|
"label = \"%u%s\" ]; \n", i, i, isSherman ? "w":"");
|
||||||
|
|
||||||
if (aux->accel_offset) {
|
if (aux->accel_offset) {
|
||||||
dumpAccelDot(f, i,
|
dumpAccelDot(f, i,
|
||||||
&((const gough_accel *)((const char *)m + aux->accel_offset))->accel);
|
&((const gough_accel *)(reinterpret_cast<const char *>(m) + aux->accel_offset))->accel);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aux->accept_eod) {
|
if (aux->accept_eod) {
|
||||||
@ -151,7 +151,7 @@ void describeNode(const NFA *n, const mcclellan *m, u16 i, FILE *f) {
|
|||||||
const char *sherman_state
|
const char *sherman_state
|
||||||
= findShermanState(m, sher_base, m->sherman_limit, i);
|
= findShermanState(m, sher_base, m->sherman_limit, i);
|
||||||
fprintf(f, "%u [ fillcolor = lightblue style=filled ];\n", i);
|
fprintf(f, "%u [ fillcolor = lightblue style=filled ];\n", i);
|
||||||
u16 daddy = *(const u16 *)(sherman_state + SHERMAN_DADDY_OFFSET);
|
u16 daddy = *(reinterpret_cast<const u16 *>(sherman_state + SHERMAN_DADDY_OFFSET));
|
||||||
if (daddy) {
|
if (daddy) {
|
||||||
fprintf(f, "%u -> %u [ color=royalblue style=dashed weight=0.1]\n",
|
fprintf(f, "%u -> %u [ color=royalblue style=dashed weight=0.1]\n",
|
||||||
i, daddy);
|
i, daddy);
|
||||||
@ -197,7 +197,7 @@ void dump_programs(FILE *f, const NFA *nfa,
|
|||||||
for (set<pair<pair<u32, u32>, u32 > >::const_iterator it
|
for (set<pair<pair<u32, u32>, u32 > >::const_iterator it
|
||||||
= prog_dump.begin(); it != prog_dump.end(); ++it) {
|
= prog_dump.begin(); it != prog_dump.end(); ++it) {
|
||||||
assert(it->second);
|
assert(it->second);
|
||||||
const gough_ins *p = (const gough_ins *)((const u8 *)nfa + it->second);
|
const gough_ins *p = reinterpret_cast<const gough_ins *>(reinterpret_cast<const u8 *>(nfa) + it->second);
|
||||||
dump_program(f, it->first, p);
|
dump_program(f, it->first, p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -205,17 +205,17 @@ void dump_programs(FILE *f, const NFA *nfa,
|
|||||||
static
|
static
|
||||||
void dumpTransitions(const NFA *nfa, FILE *f,
|
void dumpTransitions(const NFA *nfa, FILE *f,
|
||||||
set<pair<pair<u32, u32>, u32 > > *prog_dump) {
|
set<pair<pair<u32, u32>, u32 > > *prog_dump) {
|
||||||
const mcclellan *m = (const mcclellan *)getImplNfa(nfa);
|
const mcclellan *m = reinterpret_cast<const mcclellan *>(getImplNfa(nfa));
|
||||||
const gough_info *g = get_gough(m);
|
const gough_info *g = get_gough(m);
|
||||||
u32 alphaSize = 1U << m->alphaShift;
|
u32 alphaSize = 1U << m->alphaShift;
|
||||||
const u32 *prog_offset_table = (const u32 *)(g + 1);
|
const u32 *prog_offset_table = reinterpret_cast<const u32 *>(g + 1);
|
||||||
|
|
||||||
for (u16 i = 0; i < m->state_count; i++) {
|
for (u16 i = 0; i < m->state_count; i++) {
|
||||||
fprintf(f, "%05hu", i);
|
fprintf(f, "%05hu", i);
|
||||||
const mstate_aux *aux = getAux(nfa, i);
|
const mstate_aux *aux = getAux(nfa, i);
|
||||||
|
|
||||||
if (aux->accel_offset) {
|
if (aux->accel_offset) {
|
||||||
dumpAccelText(f, (const union AccelAux *)((const char *)m +
|
dumpAccelText(f, reinterpret_cast<const union AccelAux *>(reinterpret_cast<const char *>(m) +
|
||||||
aux->accel_offset));
|
aux->accel_offset));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -263,7 +263,7 @@ void dumpTransitions(const NFA *nfa, FILE *f,
|
|||||||
static
|
static
|
||||||
void nfaExecGough8_dumpDot(const struct NFA *nfa, FILE *f) {
|
void nfaExecGough8_dumpDot(const struct NFA *nfa, FILE *f) {
|
||||||
assert(nfa->type == GOUGH_NFA_8);
|
assert(nfa->type == GOUGH_NFA_8);
|
||||||
const mcclellan *m = (const mcclellan *)getImplNfa(nfa);
|
const mcclellan *m = reinterpret_cast<const mcclellan *>(getImplNfa(nfa));
|
||||||
|
|
||||||
dumpDotPreambleDfa(f);
|
dumpDotPreambleDfa(f);
|
||||||
|
|
||||||
@ -284,7 +284,7 @@ static
|
|||||||
void nfaExecGough8_dumpText(const struct NFA *nfa, FILE *f) {
|
void nfaExecGough8_dumpText(const struct NFA *nfa, FILE *f) {
|
||||||
|
|
||||||
assert(nfa->type == GOUGH_NFA_8);
|
assert(nfa->type == GOUGH_NFA_8);
|
||||||
const mcclellan *m = (const mcclellan *)getImplNfa(nfa);
|
const mcclellan *m = reinterpret_cast<const mcclellan *>(getImplNfa(nfa));
|
||||||
|
|
||||||
fprintf(f, "gough 8\n");
|
fprintf(f, "gough 8\n");
|
||||||
fprintf(f, "report: %u, states %u, length %u\n", m->arb_report,
|
fprintf(f, "report: %u, states %u, length %u\n", m->arb_report,
|
||||||
@ -308,7 +308,7 @@ void nfaExecGough8_dumpText(const struct NFA *nfa, FILE *f) {
|
|||||||
static
|
static
|
||||||
void nfaExecGough16_dumpDot(const struct NFA *nfa, FILE *f) {
|
void nfaExecGough16_dumpDot(const struct NFA *nfa, FILE *f) {
|
||||||
assert(nfa->type == GOUGH_NFA_16);
|
assert(nfa->type == GOUGH_NFA_16);
|
||||||
const mcclellan *m = (const mcclellan *)getImplNfa(nfa);
|
const mcclellan *m = reinterpret_cast<const mcclellan *>(getImplNfa(nfa));
|
||||||
|
|
||||||
dumpDotPreambleDfa(f);
|
dumpDotPreambleDfa(f);
|
||||||
|
|
||||||
@ -328,7 +328,7 @@ void nfaExecGough16_dumpDot(const struct NFA *nfa, FILE *f) {
|
|||||||
static
|
static
|
||||||
void nfaExecGough16_dumpText(const struct NFA *nfa, FILE *f) {
|
void nfaExecGough16_dumpText(const struct NFA *nfa, FILE *f) {
|
||||||
assert(nfa->type == GOUGH_NFA_16);
|
assert(nfa->type == GOUGH_NFA_16);
|
||||||
const mcclellan *m = (const mcclellan *)getImplNfa(nfa);
|
const mcclellan *m = reinterpret_cast<const mcclellan *>(getImplNfa(nfa));
|
||||||
// const gough_info *h = get_gough(m);
|
// const gough_info *h = get_gough(m);
|
||||||
|
|
||||||
fprintf(f, "gough 16\n");
|
fprintf(f, "gough 16\n");
|
||||||
|
@ -56,7 +56,7 @@ namespace ue2 {
|
|||||||
static
|
static
|
||||||
void lbrDumpCommon(const lbr_common *lc, FILE *f) {
|
void lbrDumpCommon(const lbr_common *lc, FILE *f) {
|
||||||
const RepeatInfo *info
|
const RepeatInfo *info
|
||||||
= (const RepeatInfo *)((const char *)lc + lc->repeatInfoOffset);
|
= reinterpret_cast<const RepeatInfo *>(reinterpret_cast<const char *>(lc) + lc->repeatInfoOffset);
|
||||||
fprintf(f, "Limited Bounded Repeat\n");
|
fprintf(f, "Limited Bounded Repeat\n");
|
||||||
fprintf(f, "\n");
|
fprintf(f, "\n");
|
||||||
fprintf(f, "repeat model: %s\n", repeatTypeName(info->type));
|
fprintf(f, "repeat model: %s\n", repeatTypeName(info->type));
|
||||||
@ -70,7 +70,7 @@ void lbrDumpCommon(const lbr_common *lc, FILE *f) {
|
|||||||
void nfaExecLbrDot_dump(const NFA *nfa, const string &base) {
|
void nfaExecLbrDot_dump(const NFA *nfa, const string &base) {
|
||||||
assert(nfa);
|
assert(nfa);
|
||||||
assert(nfa->type == LBR_NFA_DOT);
|
assert(nfa->type == LBR_NFA_DOT);
|
||||||
const lbr_dot *ld = (const lbr_dot *)getImplNfa(nfa);
|
const lbr_dot *ld = reinterpret_cast<const lbr_dot *>(getImplNfa(nfa));
|
||||||
StdioFile f(base + ".txt", "w");
|
StdioFile f(base + ".txt", "w");
|
||||||
lbrDumpCommon(&ld->common, f);
|
lbrDumpCommon(&ld->common, f);
|
||||||
fprintf(f, "DOT model\n");
|
fprintf(f, "DOT model\n");
|
||||||
@ -81,7 +81,7 @@ void nfaExecLbrDot_dump(const NFA *nfa, const string &base) {
|
|||||||
void nfaExecLbrVerm_dump(const NFA *nfa, const string &base) {
|
void nfaExecLbrVerm_dump(const NFA *nfa, const string &base) {
|
||||||
assert(nfa);
|
assert(nfa);
|
||||||
assert(nfa->type == LBR_NFA_VERM);
|
assert(nfa->type == LBR_NFA_VERM);
|
||||||
const lbr_verm *lv = (const lbr_verm *)getImplNfa(nfa);
|
const lbr_verm *lv = reinterpret_cast<const lbr_verm *>(getImplNfa(nfa));
|
||||||
StdioFile f(base + ".txt", "w");
|
StdioFile f(base + ".txt", "w");
|
||||||
lbrDumpCommon(&lv->common, f);
|
lbrDumpCommon(&lv->common, f);
|
||||||
fprintf(f, "VERM model, scanning for 0x%02x\n", lv->c);
|
fprintf(f, "VERM model, scanning for 0x%02x\n", lv->c);
|
||||||
@ -92,7 +92,7 @@ void nfaExecLbrVerm_dump(const NFA *nfa, const string &base) {
|
|||||||
void nfaExecLbrNVerm_dump(const NFA *nfa, const string &base) {
|
void nfaExecLbrNVerm_dump(const NFA *nfa, const string &base) {
|
||||||
assert(nfa);
|
assert(nfa);
|
||||||
assert(nfa->type == LBR_NFA_NVERM);
|
assert(nfa->type == LBR_NFA_NVERM);
|
||||||
const lbr_verm *lv = (const lbr_verm *)getImplNfa(nfa);
|
const lbr_verm *lv = reinterpret_cast<const lbr_verm *>(getImplNfa(nfa));
|
||||||
StdioFile f(base + ".txt", "w");
|
StdioFile f(base + ".txt", "w");
|
||||||
lbrDumpCommon(&lv->common, f);
|
lbrDumpCommon(&lv->common, f);
|
||||||
fprintf(f, "NEGATED VERM model, scanning for 0x%02x\n", lv->c);
|
fprintf(f, "NEGATED VERM model, scanning for 0x%02x\n", lv->c);
|
||||||
@ -106,11 +106,11 @@ void nfaExecLbrShuf_dump(const NFA *nfa, const string &base) {
|
|||||||
|
|
||||||
StdioFile f(base + ".txt", "w");
|
StdioFile f(base + ".txt", "w");
|
||||||
|
|
||||||
const lbr_shuf *ls = (const lbr_shuf *)getImplNfa(nfa);
|
const lbr_shuf *ls = reinterpret_cast<const lbr_shuf *>(getImplNfa(nfa));
|
||||||
lbrDumpCommon(&ls->common, f);
|
lbrDumpCommon(&ls->common, f);
|
||||||
|
|
||||||
CharReach cr = shufti2cr((const u8 *)&ls->mask_lo,
|
CharReach cr = shufti2cr(reinterpret_cast<const u8 *>(&ls->mask_lo),
|
||||||
(const u8 *)&ls->mask_hi);
|
reinterpret_cast<const u8 *>(&ls->mask_hi));
|
||||||
fprintf(f, "SHUF model, scanning for: %s (%zu chars)\n",
|
fprintf(f, "SHUF model, scanning for: %s (%zu chars)\n",
|
||||||
describeClass(cr, 20, CC_OUT_TEXT).c_str(), cr.count());
|
describeClass(cr, 20, CC_OUT_TEXT).c_str(), cr.count());
|
||||||
fprintf(f, "\n");
|
fprintf(f, "\n");
|
||||||
@ -123,11 +123,11 @@ void nfaExecLbrTruf_dump(const NFA *nfa, const string &base) {
|
|||||||
|
|
||||||
StdioFile f(base + ".txt", "w");
|
StdioFile f(base + ".txt", "w");
|
||||||
|
|
||||||
const lbr_truf *lt = (const lbr_truf *)getImplNfa(nfa);
|
const lbr_truf *lt = reinterpret_cast<const lbr_truf *>(getImplNfa(nfa));
|
||||||
lbrDumpCommon(<->common, f);
|
lbrDumpCommon(<->common, f);
|
||||||
|
|
||||||
CharReach cr = truffle2cr((const u8 *)<->mask1,
|
CharReach cr = truffle2cr((const u8 *)(<->mask1),
|
||||||
(const u8 *)<->mask2);
|
(const u8 *)(<->mask2));
|
||||||
fprintf(f, "TRUFFLE model, scanning for: %s (%zu chars)\n",
|
fprintf(f, "TRUFFLE model, scanning for: %s (%zu chars)\n",
|
||||||
describeClass(cr, 20, CC_OUT_TEXT).c_str(), cr.count());
|
describeClass(cr, 20, CC_OUT_TEXT).c_str(), cr.count());
|
||||||
fprintf(f, "\n");
|
fprintf(f, "\n");
|
||||||
|
@ -108,14 +108,14 @@ void dumpRepeats(const limex_type *limex, u32 model_size, FILE *f) {
|
|||||||
fprintf(f, "\n");
|
fprintf(f, "\n");
|
||||||
fprintf(f, "%u bounded repeats.\n", limex->repeatCount);
|
fprintf(f, "%u bounded repeats.\n", limex->repeatCount);
|
||||||
|
|
||||||
const char *base = (const char *)limex;
|
const char *base = reinterpret_cast<const char *>(limex);
|
||||||
const u32 *repeatOffset = (const u32 *)(base + limex->repeatOffset);
|
const u32 *repeatOffset = reinterpret_cast<const u32 *>(base + limex->repeatOffset);
|
||||||
|
|
||||||
for (u32 i = 0; i < limex->repeatCount; i++) {
|
for (u32 i = 0; i < limex->repeatCount; i++) {
|
||||||
const NFARepeatInfo *info =
|
const NFARepeatInfo *info =
|
||||||
(const NFARepeatInfo *)(base + repeatOffset[i]);
|
reinterpret_cast<const NFARepeatInfo *>(base + repeatOffset[i]);
|
||||||
const RepeatInfo *repeat =
|
const RepeatInfo *repeat =
|
||||||
(const RepeatInfo *)((const char *)info + sizeof(*info));
|
reinterpret_cast<const RepeatInfo *>(reinterpret_cast<const char *>(info) + sizeof(*info));
|
||||||
fprintf(f, " repeat %u: %s {%u,%u} packedCtrlSize=%u, "
|
fprintf(f, " repeat %u: %s {%u,%u} packedCtrlSize=%u, "
|
||||||
"stateSize=%u\n",
|
"stateSize=%u\n",
|
||||||
i, repeatTypeName(repeat->type), repeat->repeatMin,
|
i, repeatTypeName(repeat->type), repeat->repeatMin,
|
||||||
@ -123,7 +123,7 @@ void dumpRepeats(const limex_type *limex, u32 model_size, FILE *f) {
|
|||||||
fprintf(f, " nfa state: stream offset %u\n", info->stateOffset);
|
fprintf(f, " nfa state: stream offset %u\n", info->stateOffset);
|
||||||
fprintf(f, " ");
|
fprintf(f, " ");
|
||||||
|
|
||||||
const u8 *tug_mask = (const u8 *)info + info->tugMaskOffset;
|
const u8 *tug_mask = reinterpret_cast<const u8 *>(info) + info->tugMaskOffset;
|
||||||
dumpMask(f, "tugs", tug_mask, model_size);
|
dumpMask(f, "tugs", tug_mask, model_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,7 +157,7 @@ void dumpLimexReachMap(const u8 *reachMap, FILE *f) {
|
|||||||
template<typename limex_type>
|
template<typename limex_type>
|
||||||
static
|
static
|
||||||
const NFA *limex_to_nfa(const limex_type *limex) {
|
const NFA *limex_to_nfa(const limex_type *limex) {
|
||||||
return (const NFA *)((const char *)limex - sizeof(NFA));
|
return reinterpret_cast<const NFA *>(reinterpret_cast<const char *>(limex) - sizeof(NFA));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename limex_type>
|
template<typename limex_type>
|
||||||
@ -172,8 +172,8 @@ void dumpAccel(const limex_type *limex, FILE *f) {
|
|||||||
|
|
||||||
u32 tableOffset = limex->accelTableOffset;
|
u32 tableOffset = limex->accelTableOffset;
|
||||||
u32 auxOffset = limex->accelAuxOffset;
|
u32 auxOffset = limex->accelAuxOffset;
|
||||||
const u8 *accelTable = (const u8 *)((const char *)limex + tableOffset);
|
const u8 *accelTable = reinterpret_cast<const u8 *>(reinterpret_cast<const char *>(limex) + tableOffset);
|
||||||
const AccelAux *aux = (const AccelAux *)((const char *)limex + auxOffset);
|
const AccelAux *aux = reinterpret_cast<const AccelAux *>(reinterpret_cast<const char *>(limex) + auxOffset);
|
||||||
|
|
||||||
for (u32 i = 0; i < limex->accelCount; i++) {
|
for (u32 i = 0; i < limex->accelCount; i++) {
|
||||||
fprintf(f, " accel %u (aux entry %u): ", i, accelTable[i]);
|
fprintf(f, " accel %u (aux entry %u): ", i, accelTable[i]);
|
||||||
@ -191,7 +191,7 @@ void dumpAcceptList(const char *limex_base, const struct NFAAccept *accepts,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
fprintf(f, " idx %u fires report list %u:", i, a.reports);
|
fprintf(f, " idx %u fires report list %u:", i, a.reports);
|
||||||
const ReportID *report = (const ReportID *)(limex_base + a.reports);
|
const ReportID *report = reinterpret_cast<const ReportID *>(limex_base + a.reports);
|
||||||
for (; *report != MO_INVALID_IDX; report++) {
|
for (; *report != MO_INVALID_IDX; report++) {
|
||||||
fprintf(f, " %u", *report);
|
fprintf(f, " %u", *report);
|
||||||
}
|
}
|
||||||
@ -202,18 +202,18 @@ void dumpAcceptList(const char *limex_base, const struct NFAAccept *accepts,
|
|||||||
template<typename limex_type>
|
template<typename limex_type>
|
||||||
static
|
static
|
||||||
void dumpAccepts(const limex_type *limex, FILE *f) {
|
void dumpAccepts(const limex_type *limex, FILE *f) {
|
||||||
const char *limex_base = (const char *)limex;
|
const char *limex_base = reinterpret_cast<const char *>(limex);
|
||||||
|
|
||||||
const u32 acceptCount = limex->acceptCount;
|
const u32 acceptCount = limex->acceptCount;
|
||||||
const u32 acceptEodCount = limex->acceptEodCount;
|
const u32 acceptEodCount = limex->acceptEodCount;
|
||||||
|
|
||||||
fprintf(f, "\n%u accepts.\n", acceptCount);
|
fprintf(f, "\n%u accepts.\n", acceptCount);
|
||||||
const auto *accepts =
|
const auto *accepts =
|
||||||
(const struct NFAAccept *)(limex_base + limex->acceptOffset);
|
reinterpret_cast<const struct NFAAccept *>(limex_base + limex->acceptOffset);
|
||||||
dumpAcceptList(limex_base, accepts, acceptCount, f);
|
dumpAcceptList(limex_base, accepts, acceptCount, f);
|
||||||
fprintf(f, "\n%u accepts at EOD.\n", acceptEodCount);
|
fprintf(f, "\n%u accepts at EOD.\n", acceptEodCount);
|
||||||
const auto *accepts_eod =
|
const auto *accepts_eod =
|
||||||
(const struct NFAAccept *)(limex_base + limex->acceptEodOffset);
|
reinterpret_cast<const struct NFAAccept *>(limex_base + limex->acceptEodOffset);
|
||||||
dumpAcceptList(limex_base, accepts_eod, acceptEodCount, f);
|
dumpAcceptList(limex_base, accepts_eod, acceptEodCount, f);
|
||||||
fprintf(f, "\n");
|
fprintf(f, "\n");
|
||||||
}
|
}
|
||||||
@ -224,7 +224,7 @@ void dumpSquash(const limex_type *limex, FILE *f) {
|
|||||||
u32 size = limex_traits<limex_type>::size;
|
u32 size = limex_traits<limex_type>::size;
|
||||||
|
|
||||||
// Dump squash masks, if there are any.
|
// Dump squash masks, if there are any.
|
||||||
const u8 *squashMask = (const u8 *)limex + limex->squashOffset;
|
const u8 *squashMask = reinterpret_cast<const u8 *>(limex) + limex->squashOffset;
|
||||||
for (u32 i = 0; i < limex->squashCount; i++) {
|
for (u32 i = 0; i < limex->squashCount; i++) {
|
||||||
std::ostringstream name;
|
std::ostringstream name;
|
||||||
name << "squash_" << i;
|
name << "squash_" << i;
|
||||||
@ -238,7 +238,7 @@ static
|
|||||||
const typename limex_traits<limex_type>::exception_type *
|
const typename limex_traits<limex_type>::exception_type *
|
||||||
getExceptionTable(const limex_type *limex) {
|
getExceptionTable(const limex_type *limex) {
|
||||||
return (const typename limex_traits<limex_type>::exception_type *)
|
return (const typename limex_traits<limex_type>::exception_type *)
|
||||||
((const char *)limex + limex->exceptionOffset);
|
(reinterpret_cast<const char *>(limex) + limex->exceptionOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename limex_type>
|
template<typename limex_type>
|
||||||
@ -248,7 +248,7 @@ void dumpLimexExceptions(const limex_type *limex, FILE *f) {
|
|||||||
getExceptionTable(limex);
|
getExceptionTable(limex);
|
||||||
const u32 size = limex_traits<limex_type>::size;
|
const u32 size = limex_traits<limex_type>::size;
|
||||||
|
|
||||||
const char *limex_base = (const char *)limex;
|
const char *limex_base = reinterpret_cast<const char *>(limex);
|
||||||
|
|
||||||
fprintf(f, "\n");
|
fprintf(f, "\n");
|
||||||
for (u32 i = 0; i < limex->exceptionCount; i++) {
|
for (u32 i = 0; i < limex->exceptionCount; i++) {
|
||||||
@ -259,13 +259,13 @@ void dumpLimexExceptions(const limex_type *limex, FILE *f) {
|
|||||||
case LIMEX_TRIGGER_POS: fprintf(f, " trigger: POS\n"); break;
|
case LIMEX_TRIGGER_POS: fprintf(f, " trigger: POS\n"); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
dumpMask(f, "succ", (const u8 *)&e[i].successors, size);
|
dumpMask(f, "succ", reinterpret_cast<const u8 *>(&e[i].successors), size);
|
||||||
dumpMask(f, "squash", (const u8 *)&e[i].squash, size);
|
dumpMask(f, "squash", reinterpret_cast<const u8 *>(&e[i].squash), size);
|
||||||
fprintf(f, "reports: ");
|
fprintf(f, "reports: ");
|
||||||
if (e[i].reports == MO_INVALID_IDX) {
|
if (e[i].reports == MO_INVALID_IDX) {
|
||||||
fprintf(f, " <none>\n");
|
fprintf(f, " <none>\n");
|
||||||
} else {
|
} else {
|
||||||
const ReportID *r = (const ReportID *)(limex_base + e[i].reports);
|
const ReportID *r = reinterpret_cast<const ReportID *>(limex_base + e[i].reports);
|
||||||
while (*r != MO_INVALID_IDX) {
|
while (*r != MO_INVALID_IDX) {
|
||||||
fprintf(f, " %u", *r++);
|
fprintf(f, " %u", *r++);
|
||||||
}
|
}
|
||||||
@ -282,7 +282,7 @@ void dumpLimexShifts(const limex_type *limex, FILE *f) {
|
|||||||
fprintf(f, "Shift Masks:\n");
|
fprintf(f, "Shift Masks:\n");
|
||||||
for(u32 i = 0; i < limex->shiftCount; i++) {
|
for(u32 i = 0; i < limex->shiftCount; i++) {
|
||||||
fprintf(f, "\t Shift %u(%hhu)\t\tMask: %s\n", i, limex->shiftAmount[i],
|
fprintf(f, "\t Shift %u(%hhu)\t\tMask: %s\n", i, limex->shiftAmount[i],
|
||||||
dumpMask((const u8 *)&limex->shift[i], size).c_str());
|
dumpMask(reinterpret_cast<const u8 *>(&limex->shift[i]), size).c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
template<typename limex_type>
|
template<typename limex_type>
|
||||||
@ -304,20 +304,20 @@ void dumpLimexText(const limex_type *limex, FILE *f) {
|
|||||||
}
|
}
|
||||||
fprintf(f, "\n\n");
|
fprintf(f, "\n\n");
|
||||||
|
|
||||||
dumpMask(f, "init", (const u8 *)&limex->init, size);
|
dumpMask(f, "init", reinterpret_cast<const u8 *>(&limex->init), size);
|
||||||
dumpMask(f, "init_dot_star", (const u8 *)&limex->initDS, size);
|
dumpMask(f, "init_dot_star", reinterpret_cast<const u8 *>(&limex->initDS), size);
|
||||||
dumpMask(f, "accept", (const u8 *)&limex->accept, size);
|
dumpMask(f, "accept", reinterpret_cast<const u8 *>(&limex->accept), size);
|
||||||
dumpMask(f, "accept_at_eod", (const u8 *)&limex->acceptAtEOD, size);
|
dumpMask(f, "accept_at_eod", reinterpret_cast<const u8 *>(&limex->acceptAtEOD), size);
|
||||||
dumpMask(f, "accel", (const u8 *)&limex->accel, size);
|
dumpMask(f, "accel", reinterpret_cast<const u8 *>(&limex->accel), size);
|
||||||
dumpMask(f, "accel_and_friends", (const u8 *)&limex->accel_and_friends,
|
dumpMask(f, "accel_and_friends", reinterpret_cast<const u8 *>(&limex->accel_and_friends),
|
||||||
size);
|
size);
|
||||||
dumpMask(f, "compress_mask", (const u8 *)&limex->compressMask, size);
|
dumpMask(f, "compress_mask", reinterpret_cast<const u8 *>(&limex->compressMask), size);
|
||||||
dumpMask(f, "emask", (const u8 *)&limex->exceptionMask, size);
|
dumpMask(f, "emask", reinterpret_cast<const u8 *>(&limex->exceptionMask), size);
|
||||||
dumpMask(f, "zombie", (const u8 *)&limex->zombieMask, size);
|
dumpMask(f, "zombie", reinterpret_cast<const u8 *>(&limex->zombieMask), size);
|
||||||
|
|
||||||
// Dump top masks, if there are any.
|
// Dump top masks, if there are any.
|
||||||
u32 topCount = limex->topCount;
|
u32 topCount = limex->topCount;
|
||||||
const u8 *topMask = (const u8 *)limex + limex->topOffset;
|
const u8 *topMask = reinterpret_cast<const u8 *>(limex) + limex->topOffset;
|
||||||
for (u32 i = 0; i < topCount; i++) {
|
for (u32 i = 0; i < topCount; i++) {
|
||||||
std::ostringstream name;
|
std::ostringstream name;
|
||||||
name << "top_" << i;
|
name << "top_" << i;
|
||||||
@ -331,7 +331,7 @@ void dumpLimexText(const limex_type *limex, FILE *f) {
|
|||||||
dumpSquash(limex, f);
|
dumpSquash(limex, f);
|
||||||
|
|
||||||
dumpLimexReachMap(limex->reachMap, f);
|
dumpLimexReachMap(limex->reachMap, f);
|
||||||
dumpLimexReachMasks(size, (const u8 *)limex + sizeof(*limex) /* reach*/,
|
dumpLimexReachMasks(size, reinterpret_cast<const u8 *>(limex) + sizeof(*limex) /* reach*/,
|
||||||
limex->reachSize, f);
|
limex->reachSize, f);
|
||||||
|
|
||||||
dumpAccepts(limex, f);
|
dumpAccepts(limex, f);
|
||||||
@ -378,7 +378,7 @@ struct limex_labeller : public nfa_labeller {
|
|||||||
void label_state(FILE *f, u32 state) const override {
|
void label_state(FILE *f, u32 state) const override {
|
||||||
const typename limex_traits<limex_type>::exception_type *exceptions
|
const typename limex_traits<limex_type>::exception_type *exceptions
|
||||||
= getExceptionTable(limex);
|
= getExceptionTable(limex);
|
||||||
if (!testbit((const u8 *)&limex->exceptionMask,
|
if (!testbit(reinterpret_cast<const u8 *>(&limex->exceptionMask),
|
||||||
limex_traits<limex_type>::size, state)) {
|
limex_traits<limex_type>::size, state)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -404,11 +404,11 @@ static
|
|||||||
void dumpVertexDotInfo(const limex_type *limex, u32 state_count, FILE *f,
|
void dumpVertexDotInfo(const limex_type *limex, u32 state_count, FILE *f,
|
||||||
const nfa_labeller &labeller) {
|
const nfa_labeller &labeller) {
|
||||||
u32 size = sizeof(limex->init) * 8;
|
u32 size = sizeof(limex->init) * 8;
|
||||||
const u8 *reach = (const u8 *)limex + sizeof(*limex);
|
const u8 *reach = reinterpret_cast<const u8 *>(limex) + sizeof(*limex);
|
||||||
vector<CharReach> perStateReach;
|
vector<CharReach> perStateReach;
|
||||||
setupReach(limex->reachMap, reach, size, state_count, &perStateReach);
|
setupReach(limex->reachMap, reach, size, state_count, &perStateReach);
|
||||||
|
|
||||||
const u8 *topMask = (const u8 *)limex + limex->topOffset;
|
const u8 *topMask = reinterpret_cast<const u8 *>(limex) + limex->topOffset;
|
||||||
|
|
||||||
for (u32 state = 0; state < state_count; state++) {
|
for (u32 state = 0; state < state_count; state++) {
|
||||||
fprintf(f, "%u [ width = 1, fixedsize = true, fontsize = 12, "
|
fprintf(f, "%u [ width = 1, fixedsize = true, fontsize = 12, "
|
||||||
@ -419,15 +419,15 @@ void dumpVertexDotInfo(const limex_type *limex, u32 state_count, FILE *f,
|
|||||||
// bung in another couple lines to push char class (the widest thing) up a bit
|
// bung in another couple lines to push char class (the widest thing) up a bit
|
||||||
fprintf(f, "\\n\\n\" ];\n");
|
fprintf(f, "\\n\\n\" ];\n");
|
||||||
|
|
||||||
if (testbit((const u8 *)&limex->acceptAtEOD, size, state)) {
|
if (testbit(reinterpret_cast<const u8 *>(&limex->acceptAtEOD), size, state)) {
|
||||||
fprintf(f, "%u [ shape = box ];\n", state);
|
fprintf(f, "%u [ shape = box ];\n", state);
|
||||||
} else if (testbit((const u8 *)&limex->accept, size, state)) {
|
} else if (testbit(reinterpret_cast<const u8 *>(&limex->accept), size, state)) {
|
||||||
fprintf(f, "%u [ shape = doublecircle ];\n", state);
|
fprintf(f, "%u [ shape = doublecircle ];\n", state);
|
||||||
}
|
}
|
||||||
if (testbit((const u8 *)&limex->accel, size, state)) {
|
if (testbit(reinterpret_cast<const u8 *>(&limex->accel), size, state)) {
|
||||||
fprintf(f, "%u [ color = red style = diagonals];\n", state);
|
fprintf(f, "%u [ color = red style = diagonals];\n", state);
|
||||||
}
|
}
|
||||||
if (testbit((const u8 *)&limex->init, size, state)) {
|
if (testbit(reinterpret_cast<const u8 *>(&limex->init), size, state)) {
|
||||||
fprintf(f, "START -> %u [ color = grey ];\n", state);
|
fprintf(f, "START -> %u [ color = grey ];\n", state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -447,7 +447,7 @@ template<typename limex_type>
|
|||||||
static
|
static
|
||||||
void dumpExDotInfo(const limex_type *limex, u32 state, FILE *f) {
|
void dumpExDotInfo(const limex_type *limex, u32 state, FILE *f) {
|
||||||
u32 size = limex_traits<limex_type>::size;
|
u32 size = limex_traits<limex_type>::size;
|
||||||
if (!testbit((const u8 *)&limex->exceptionMask, size, state)) {
|
if (!testbit(reinterpret_cast<const u8 *>(&limex->exceptionMask), size, state)) {
|
||||||
return; /* not exceptional */
|
return; /* not exceptional */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -461,10 +461,10 @@ void dumpExDotInfo(const limex_type *limex, u32 state, FILE *f) {
|
|||||||
u32 state_count = limex_to_nfa(limex)->nPositions;
|
u32 state_count = limex_to_nfa(limex)->nPositions;
|
||||||
|
|
||||||
for (u32 j = 0; j < state_count; j++) {
|
for (u32 j = 0; j < state_count; j++) {
|
||||||
if (testbit((const u8 *)&e->successors, size, j)) {
|
if (testbit(reinterpret_cast<const u8 *>(&e->successors), size, j)) {
|
||||||
fprintf(f, "%u -> %u [color = blue];\n", state, j);
|
fprintf(f, "%u -> %u [color = blue];\n", state, j);
|
||||||
}
|
}
|
||||||
if (!testbit((const u8 *)&e->squash, size, j)) {
|
if (!testbit(reinterpret_cast<const u8 *>(&e->squash), size, j)) {
|
||||||
fprintf(f, "%u -> %u [color = grey style = dashed];\n", state, j);
|
fprintf(f, "%u -> %u [color = grey style = dashed];\n", state, j);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -480,7 +480,7 @@ static
|
|||||||
void dumpLimDotInfo(const limex_type *limex, u32 state, FILE *f) {
|
void dumpLimDotInfo(const limex_type *limex, u32 state, FILE *f) {
|
||||||
for (u32 j = 0; j < limex->shiftCount; j++) {
|
for (u32 j = 0; j < limex->shiftCount; j++) {
|
||||||
const u32 shift_amount = limex->shiftAmount[j];
|
const u32 shift_amount = limex->shiftAmount[j];
|
||||||
if (testbit((const u8 *)&limex->shift[j],
|
if (testbit(reinterpret_cast<const u8 *>(&limex->shift[j]),
|
||||||
limex_traits<limex_type>::size, state)) {
|
limex_traits<limex_type>::size, state)) {
|
||||||
fprintf(f, "%u -> %u;\n", state, state + shift_amount);
|
fprintf(f, "%u -> %u;\n", state, state + shift_amount);
|
||||||
}
|
}
|
||||||
@ -502,7 +502,7 @@ void dumpLimexDot(const NFA *nfa, const limex_type *limex, FILE *f) {
|
|||||||
|
|
||||||
#define LIMEX_DUMP_FN(size) \
|
#define LIMEX_DUMP_FN(size) \
|
||||||
void nfaExecLimEx##size##_dump(const NFA *nfa, const string &base) { \
|
void nfaExecLimEx##size##_dump(const NFA *nfa, const string &base) { \
|
||||||
auto limex = (const LimExNFA##size *)getImplNfa(nfa); \
|
auto limex = reinterpret_cast<const LimExNFA##size *>(getImplNfa(nfa)); \
|
||||||
dumpLimexText(limex, StdioFile(base + ".txt", "w")); \
|
dumpLimexText(limex, StdioFile(base + ".txt", "w")); \
|
||||||
dumpLimexDot(nfa, limex, StdioFile(base + ".dot", "w")); \
|
dumpLimexDot(nfa, limex, StdioFile(base + ".dot", "w")); \
|
||||||
}
|
}
|
||||||
|
@ -61,32 +61,32 @@ namespace ue2 {
|
|||||||
const mstate_aux *getAux(const NFA *n, dstate_id_t i) {
|
const mstate_aux *getAux(const NFA *n, dstate_id_t i) {
|
||||||
assert(n && isDfaType(n->type));
|
assert(n && isDfaType(n->type));
|
||||||
|
|
||||||
const mcclellan *m = (const mcclellan *)getImplNfa(n);
|
const mcclellan *m = reinterpret_cast<const mcclellan *>(getImplNfa(n));
|
||||||
const mstate_aux *aux_base
|
const mstate_aux *aux_base
|
||||||
= (const mstate_aux *)((const char *)n + m->aux_offset);
|
= reinterpret_cast<const mstate_aux *>(reinterpret_cast<const char *>(n) + m->aux_offset);
|
||||||
|
|
||||||
const mstate_aux *aux = aux_base + i;
|
const mstate_aux *aux = aux_base + i;
|
||||||
|
|
||||||
assert((const char *)aux < (const char *)n + m->length);
|
assert(reinterpret_cast<const char *>(aux) < reinterpret_cast<const char *>(n) + m->length);
|
||||||
return aux;
|
return aux;
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
void mcclellanGetTransitions(const NFA *n, u16 s, u16 *t) {
|
void mcclellanGetTransitions(const NFA *n, u16 s, u16 *t) {
|
||||||
assert(isMcClellanType(n->type));
|
assert(isMcClellanType(n->type));
|
||||||
const mcclellan *m = (const mcclellan *)getImplNfa(n);
|
const mcclellan *m = reinterpret_cast<const mcclellan *>(getImplNfa(n));
|
||||||
const mstate_aux *aux = getAux(n, s);
|
const mstate_aux *aux = getAux(n, s);
|
||||||
const u32 as = m->alphaShift;
|
const u32 as = m->alphaShift;
|
||||||
|
|
||||||
if (n->type == MCCLELLAN_NFA_8) {
|
if (n->type == MCCLELLAN_NFA_8) {
|
||||||
const u8 *succ_table = (const u8 *)((const char *)m
|
const u8 *succ_table = reinterpret_cast<const u8 *>(reinterpret_cast<const char *>(m)
|
||||||
+ sizeof(mcclellan));
|
+ sizeof(mcclellan));
|
||||||
for (u16 c = 0; c < N_CHARS; c++) {
|
for (u16 c = 0; c < N_CHARS; c++) {
|
||||||
t[c] = succ_table[((u32)s << as) + m->remap[c]];
|
t[c] = succ_table[((u32)s << as) + m->remap[c]];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
u16 base_s = s;
|
u16 base_s = s;
|
||||||
const char *winfo_base = (const char *)n + m->sherman_offset;
|
const char *winfo_base = reinterpret_cast<const char *>(n) + m->sherman_offset;
|
||||||
const char *state_base
|
const char *state_base
|
||||||
= winfo_base + SHERMAN_FIXED_SIZE * (s - m->sherman_limit);
|
= winfo_base + SHERMAN_FIXED_SIZE * (s - m->sherman_limit);
|
||||||
|
|
||||||
@ -94,10 +94,10 @@ void mcclellanGetTransitions(const NFA *n, u16 s, u16 *t) {
|
|||||||
base_s = unaligned_load_u16(state_base + SHERMAN_DADDY_OFFSET);
|
base_s = unaligned_load_u16(state_base + SHERMAN_DADDY_OFFSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
const u16 *succ_table = (const u16 *)((const char *)m
|
const u16 *succ_table = reinterpret_cast<const u16 *>(reinterpret_cast<const char *>(m)
|
||||||
+ sizeof(mcclellan));
|
+ sizeof(mcclellan));
|
||||||
for (u16 c = 0; c < N_CHARS; c++) {
|
for (u16 c = 0; c < N_CHARS; c++) {
|
||||||
const u8 *addr = (const u8*)(succ_table + (((u32)base_s << as)
|
const u8 *addr = reinterpret_cast<const u8*>(succ_table + (((u32)base_s << as)
|
||||||
+ m->remap[c]));
|
+ m->remap[c]));
|
||||||
t[c] = unaligned_load_u16(addr);
|
t[c] = unaligned_load_u16(addr);
|
||||||
t[c] &= STATE_MASK;
|
t[c] &= STATE_MASK;
|
||||||
@ -106,15 +106,15 @@ void mcclellanGetTransitions(const NFA *n, u16 s, u16 *t) {
|
|||||||
if (s >= m->sherman_limit) {
|
if (s >= m->sherman_limit) {
|
||||||
UNUSED char type = *(state_base + SHERMAN_TYPE_OFFSET);
|
UNUSED char type = *(state_base + SHERMAN_TYPE_OFFSET);
|
||||||
assert(type == SHERMAN_STATE);
|
assert(type == SHERMAN_STATE);
|
||||||
u8 len = *(const u8 *)(SHERMAN_LEN_OFFSET + state_base);
|
u8 len = *(reinterpret_cast<const u8 *>(SHERMAN_LEN_OFFSET + state_base));
|
||||||
const char *chars = state_base + SHERMAN_CHARS_OFFSET;
|
const char *chars = state_base + SHERMAN_CHARS_OFFSET;
|
||||||
const u16 *states = (const u16 *)(state_base
|
const u16 *states = reinterpret_cast<const u16 *>(state_base
|
||||||
+ SHERMAN_STATES_OFFSET(len));
|
+ SHERMAN_STATES_OFFSET(len));
|
||||||
|
|
||||||
for (u8 i = 0; i < len; i++) {
|
for (u8 i = 0; i < len; i++) {
|
||||||
for (u16 c = 0; c < N_CHARS; c++) {
|
for (u16 c = 0; c < N_CHARS; c++) {
|
||||||
if (m->remap[c] == chars[i]) {
|
if (m->remap[c] == chars[i]) {
|
||||||
t[c] = unaligned_load_u16((const u8*)&states[i]) & STATE_MASK;
|
t[c] = unaligned_load_u16(reinterpret_cast<const u8*>(&states[i])) & STATE_MASK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -218,8 +218,8 @@ void describeNode(const NFA *n, const mcclellan *m, u16 i, FILE *f) {
|
|||||||
"label = \"%u%s\" ]; \n", i, i, isSherman ? "w":"");
|
"label = \"%u%s\" ]; \n", i, i, isSherman ? "w":"");
|
||||||
|
|
||||||
if (aux->accel_offset) {
|
if (aux->accel_offset) {
|
||||||
dumpAccelDot(f, i, (const union AccelAux *)
|
dumpAccelDot(f, i, reinterpret_cast<const union AccelAux *>
|
||||||
((const char *)m + aux->accel_offset));
|
(reinterpret_cast<const char *>(m) + aux->accel_offset));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aux->accept_eod) {
|
if (aux->accept_eod) {
|
||||||
@ -244,14 +244,14 @@ void describeNode(const NFA *n, const mcclellan *m, u16 i, FILE *f) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isSherman) {
|
if (isSherman) {
|
||||||
const char *winfo_base = (const char *)n + m->sherman_offset;
|
const char *winfo_base = reinterpret_cast<const char *>(n) + m->sherman_offset;
|
||||||
const char *state_base
|
const char *state_base
|
||||||
= winfo_base + SHERMAN_FIXED_SIZE * (i - m->sherman_limit);
|
= winfo_base + SHERMAN_FIXED_SIZE * (i - m->sherman_limit);
|
||||||
assert(state_base < (const char *)m + m->length - sizeof(NFA));
|
assert(state_base < reinterpret_cast<const char *>(m) + m->length - sizeof(NFA));
|
||||||
UNUSED u8 type = *(const u8 *)(state_base + SHERMAN_TYPE_OFFSET);
|
UNUSED u8 type = *(reinterpret_cast<const u8 *>(state_base + SHERMAN_TYPE_OFFSET));
|
||||||
assert(type == SHERMAN_STATE);
|
assert(type == SHERMAN_STATE);
|
||||||
fprintf(f, "%u [ fillcolor = lightblue style=filled ];\n", i);
|
fprintf(f, "%u [ fillcolor = lightblue style=filled ];\n", i);
|
||||||
u16 daddy = *(const u16 *)(state_base + SHERMAN_DADDY_OFFSET);
|
u16 daddy = *(reinterpret_cast<const u16 *>(state_base + SHERMAN_DADDY_OFFSET));
|
||||||
if (daddy) {
|
if (daddy) {
|
||||||
fprintf(f, "%u -> %u [ color=royalblue style=dashed weight=0.1]\n",
|
fprintf(f, "%u -> %u [ color=royalblue style=dashed weight=0.1]\n",
|
||||||
i, daddy);
|
i, daddy);
|
||||||
@ -271,7 +271,7 @@ void dumpDotPreambleDfa(FILE *f) {
|
|||||||
static
|
static
|
||||||
void nfaExecMcClellan16_dumpDot(const NFA *nfa, FILE *f) {
|
void nfaExecMcClellan16_dumpDot(const NFA *nfa, FILE *f) {
|
||||||
assert(nfa->type == MCCLELLAN_NFA_16);
|
assert(nfa->type == MCCLELLAN_NFA_16);
|
||||||
const mcclellan *m = (const mcclellan *)getImplNfa(nfa);
|
const mcclellan *m = reinterpret_cast<const mcclellan *>(getImplNfa(nfa));
|
||||||
|
|
||||||
dumpDotPreambleDfa(f);
|
dumpDotPreambleDfa(f);
|
||||||
|
|
||||||
@ -292,7 +292,7 @@ void nfaExecMcClellan16_dumpDot(const NFA *nfa, FILE *f) {
|
|||||||
static
|
static
|
||||||
void nfaExecMcClellan8_dumpDot(const NFA *nfa, FILE *f) {
|
void nfaExecMcClellan8_dumpDot(const NFA *nfa, FILE *f) {
|
||||||
assert(nfa->type == MCCLELLAN_NFA_8);
|
assert(nfa->type == MCCLELLAN_NFA_8);
|
||||||
const mcclellan *m = (const mcclellan *)getImplNfa(nfa);
|
const mcclellan *m = reinterpret_cast<const mcclellan *>(getImplNfa(nfa));
|
||||||
|
|
||||||
dumpDotPreambleDfa(f);
|
dumpDotPreambleDfa(f);
|
||||||
|
|
||||||
@ -321,7 +321,7 @@ void dumpAccelMasks(FILE *f, const mcclellan *m, const mstate_aux *aux) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const AccelAux *accel = (const AccelAux *)((const char *)m
|
const AccelAux *accel = reinterpret_cast<const AccelAux *>(reinterpret_cast<const char *>(m)
|
||||||
+ aux[i].accel_offset);
|
+ aux[i].accel_offset);
|
||||||
fprintf(f, "%05hu ", i);
|
fprintf(f, "%05hu ", i);
|
||||||
dumpAccelInfo(f, *accel);
|
dumpAccelInfo(f, *accel);
|
||||||
@ -366,7 +366,7 @@ void dumpTransitions(FILE *f, const NFA *nfa, const mcclellan *m,
|
|||||||
for (u16 i = 0; i < sherman_ceil; i++) {
|
for (u16 i = 0; i < sherman_ceil; i++) {
|
||||||
fprintf(f, "%05hu", i);
|
fprintf(f, "%05hu", i);
|
||||||
if (aux[i].accel_offset) {
|
if (aux[i].accel_offset) {
|
||||||
dumpAccelText(f, (const union AccelAux *)((const char *)m +
|
dumpAccelText(f, reinterpret_cast<const union AccelAux *>(reinterpret_cast<const char *>(m) +
|
||||||
aux[i].accel_offset));
|
aux[i].accel_offset));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -404,9 +404,9 @@ void dumpTransitions(FILE *f, const NFA *nfa, const mcclellan *m,
|
|||||||
static
|
static
|
||||||
void nfaExecMcClellan16_dumpText(const NFA *nfa, FILE *f) {
|
void nfaExecMcClellan16_dumpText(const NFA *nfa, FILE *f) {
|
||||||
assert(nfa->type == MCCLELLAN_NFA_16);
|
assert(nfa->type == MCCLELLAN_NFA_16);
|
||||||
const mcclellan *m = (const mcclellan *)getImplNfa(nfa);
|
const mcclellan *m = reinterpret_cast<const mcclellan *>(getImplNfa(nfa));
|
||||||
const mstate_aux *aux =
|
const mstate_aux *aux =
|
||||||
(const mstate_aux *)((const char *)nfa + m->aux_offset);
|
reinterpret_cast<const mstate_aux *>(reinterpret_cast<const char *>(nfa) + m->aux_offset);
|
||||||
|
|
||||||
fprintf(f, "mcclellan 16\n");
|
fprintf(f, "mcclellan 16\n");
|
||||||
dumpCommonHeader(f, m);
|
dumpCommonHeader(f, m);
|
||||||
@ -425,9 +425,9 @@ void nfaExecMcClellan16_dumpText(const NFA *nfa, FILE *f) {
|
|||||||
static
|
static
|
||||||
void nfaExecMcClellan8_dumpText(const NFA *nfa, FILE *f) {
|
void nfaExecMcClellan8_dumpText(const NFA *nfa, FILE *f) {
|
||||||
assert(nfa->type == MCCLELLAN_NFA_8);
|
assert(nfa->type == MCCLELLAN_NFA_8);
|
||||||
const mcclellan *m = (const mcclellan *)getImplNfa(nfa);
|
const mcclellan *m = reinterpret_cast<const mcclellan *>(getImplNfa(nfa));
|
||||||
const mstate_aux *aux =
|
const mstate_aux *aux =
|
||||||
(const mstate_aux *)((const char *)nfa + m->aux_offset);
|
reinterpret_cast<const mstate_aux *>(reinterpret_cast<const char *>(nfa) + m->aux_offset);
|
||||||
|
|
||||||
fprintf(f, "mcclellan 8\n");
|
fprintf(f, "mcclellan 8\n");
|
||||||
dumpCommonHeader(f, m);
|
dumpCommonHeader(f, m);
|
||||||
|
@ -58,18 +58,18 @@ namespace ue2 {
|
|||||||
|
|
||||||
static
|
static
|
||||||
const mstate_aux *getAux(const NFA *n, dstate_id_t i) {
|
const mstate_aux *getAux(const NFA *n, dstate_id_t i) {
|
||||||
auto *m = (const mcsheng *)getImplNfa(n);
|
auto *m = reinterpret_cast<const mcsheng *>(getImplNfa(n));
|
||||||
auto *aux_base = (const mstate_aux *)((const char *)n + m->aux_offset);
|
auto *aux_base = reinterpret_cast<const mstate_aux *>(reinterpret_cast<const char *>(n) + m->aux_offset);
|
||||||
|
|
||||||
const mstate_aux *aux = aux_base + i;
|
const mstate_aux *aux = aux_base + i;
|
||||||
|
|
||||||
assert((const char *)aux < (const char *)n + m->length);
|
assert(reinterpret_cast<const char *>(aux) < reinterpret_cast<const char *>(n) + m->length);
|
||||||
return aux;
|
return aux;
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
void next_states(const NFA *n, u16 s, u16 *t) {
|
void next_states(const NFA *n, u16 s, u16 *t) {
|
||||||
const mcsheng *m = (const mcsheng *)getImplNfa(n);
|
const mcsheng *m = reinterpret_cast<const mcsheng *>(getImplNfa(n));
|
||||||
const mstate_aux *aux = getAux(n, s);
|
const mstate_aux *aux = getAux(n, s);
|
||||||
const u32 as = m->alphaShift;
|
const u32 as = m->alphaShift;
|
||||||
assert(s != DEAD_STATE);
|
assert(s != DEAD_STATE);
|
||||||
@ -77,7 +77,7 @@ void next_states(const NFA *n, u16 s, u16 *t) {
|
|||||||
if (s < m->sheng_end) {
|
if (s < m->sheng_end) {
|
||||||
for (u16 c = 0; c < N_CHARS; c++) {
|
for (u16 c = 0; c < N_CHARS; c++) {
|
||||||
u8 sheng_s = s - 1;
|
u8 sheng_s = s - 1;
|
||||||
auto trans_for_c = (const char *)&m->sheng_masks[c];
|
auto trans_for_c = reinterpret_cast<const char *>(&m->sheng_masks[c]);
|
||||||
assert(sheng_s < sizeof(m128));
|
assert(sheng_s < sizeof(m128));
|
||||||
u8 raw_succ = trans_for_c[sheng_s];
|
u8 raw_succ = trans_for_c[sheng_s];
|
||||||
if (raw_succ == m->sheng_end - 1) {
|
if (raw_succ == m->sheng_end - 1) {
|
||||||
@ -89,14 +89,14 @@ void next_states(const NFA *n, u16 s, u16 *t) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (n->type == MCSHENG_NFA_8) {
|
} else if (n->type == MCSHENG_NFA_8) {
|
||||||
const u8 *succ_table = (const u8 *)((const char *)m + sizeof(mcsheng));
|
const u8 *succ_table = reinterpret_cast<const u8 *>(reinterpret_cast<const char *>(m) + sizeof(mcsheng));
|
||||||
for (u16 c = 0; c < N_CHARS; c++) {
|
for (u16 c = 0; c < N_CHARS; c++) {
|
||||||
u32 normal_id = s - m->sheng_end;
|
u32 normal_id = s - m->sheng_end;
|
||||||
t[c] = succ_table[(normal_id << as) + m->remap[c]];
|
t[c] = succ_table[(normal_id << as) + m->remap[c]];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
u16 base_s = s;
|
u16 base_s = s;
|
||||||
const char *winfo_base = (const char *)n + m->sherman_offset;
|
const char *winfo_base = reinterpret_cast<const char *>(n) + m->sherman_offset;
|
||||||
const char *state_base
|
const char *state_base
|
||||||
= winfo_base + SHERMAN_FIXED_SIZE * (s - m->sherman_limit);
|
= winfo_base + SHERMAN_FIXED_SIZE * (s - m->sherman_limit);
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ void next_states(const NFA *n, u16 s, u16 *t) {
|
|||||||
assert(base_s >= m->sheng_end);
|
assert(base_s >= m->sheng_end);
|
||||||
}
|
}
|
||||||
|
|
||||||
const u16 *succ_table = (const u16 *)((const char *)m
|
const u16 *succ_table = reinterpret_cast<const u16 *>(reinterpret_cast<const char *>(m)
|
||||||
+ sizeof(mcsheng));
|
+ sizeof(mcsheng));
|
||||||
for (u16 c = 0; c < N_CHARS; c++) {
|
for (u16 c = 0; c < N_CHARS; c++) {
|
||||||
u32 normal_id = base_s - m->sheng_end;
|
u32 normal_id = base_s - m->sheng_end;
|
||||||
@ -115,15 +115,15 @@ void next_states(const NFA *n, u16 s, u16 *t) {
|
|||||||
if (s >= m->sherman_limit) {
|
if (s >= m->sherman_limit) {
|
||||||
UNUSED char type = *(state_base + SHERMAN_TYPE_OFFSET);
|
UNUSED char type = *(state_base + SHERMAN_TYPE_OFFSET);
|
||||||
assert(type == SHERMAN_STATE);
|
assert(type == SHERMAN_STATE);
|
||||||
u8 len = *(const u8 *)(SHERMAN_LEN_OFFSET + state_base);
|
u8 len = *(reinterpret_cast<const u8 *>(SHERMAN_LEN_OFFSET + state_base));
|
||||||
const char *chars = state_base + SHERMAN_CHARS_OFFSET;
|
const char *chars = state_base + SHERMAN_CHARS_OFFSET;
|
||||||
const u16 *states = (const u16 *)(state_base
|
const u16 *states = reinterpret_cast<const u16 *>(state_base
|
||||||
+ SHERMAN_STATES_OFFSET(len));
|
+ SHERMAN_STATES_OFFSET(len));
|
||||||
|
|
||||||
for (u8 i = 0; i < len; i++) {
|
for (u8 i = 0; i < len; i++) {
|
||||||
for (u16 c = 0; c < N_CHARS; c++) {
|
for (u16 c = 0; c < N_CHARS; c++) {
|
||||||
if (m->remap[c] == chars[i]) {
|
if (m->remap[c] == chars[i]) {
|
||||||
t[c] = unaligned_load_u16((const u8*)&states[i]);
|
t[c] = unaligned_load_u16(reinterpret_cast<const u8*>(&states[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -176,18 +176,18 @@ void describeEdge(FILE *f, const mcsheng *m, const u16 *t, u16 i) {
|
|||||||
|
|
||||||
static
|
static
|
||||||
const mstate_aux *getAux64(const NFA *n, dstate_id_t i) {
|
const mstate_aux *getAux64(const NFA *n, dstate_id_t i) {
|
||||||
auto *m = (const mcsheng64 *)getImplNfa(n);
|
auto *m = reinterpret_cast<const mcsheng64 *>(getImplNfa(n));
|
||||||
auto *aux_base = (const mstate_aux *)((const char *)n + m->aux_offset);
|
auto *aux_base = reinterpret_cast<const mstate_aux *>(reinterpret_cast<const char *>(n) + m->aux_offset);
|
||||||
|
|
||||||
const mstate_aux *aux = aux_base + i;
|
const mstate_aux *aux = aux_base + i;
|
||||||
|
|
||||||
assert((const char *)aux < (const char *)n + m->length);
|
assert(reinterpret_cast<const char *>(aux) < reinterpret_cast<const char *>(n) + m->length);
|
||||||
return aux;
|
return aux;
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
void next_states64(const NFA *n, u16 s, u16 *t) {
|
void next_states64(const NFA *n, u16 s, u16 *t) {
|
||||||
const mcsheng64 *m = (const mcsheng64 *)getImplNfa(n);
|
const mcsheng64 *m = reinterpret_cast<const mcsheng64 *>(getImplNfa(n));
|
||||||
const mstate_aux *aux = getAux64(n, s);
|
const mstate_aux *aux = getAux64(n, s);
|
||||||
const u32 as = m->alphaShift;
|
const u32 as = m->alphaShift;
|
||||||
assert(s != DEAD_STATE);
|
assert(s != DEAD_STATE);
|
||||||
@ -195,7 +195,7 @@ void next_states64(const NFA *n, u16 s, u16 *t) {
|
|||||||
if (s < m->sheng_end) {
|
if (s < m->sheng_end) {
|
||||||
for (u16 c = 0; c < N_CHARS; c++) {
|
for (u16 c = 0; c < N_CHARS; c++) {
|
||||||
u8 sheng_s = s - 1;
|
u8 sheng_s = s - 1;
|
||||||
auto trans_for_c = (const char *)&m->sheng_succ_masks[c];
|
auto trans_for_c = reinterpret_cast<const char *>(&m->sheng_succ_masks[c]);
|
||||||
assert(sheng_s < sizeof(m512));
|
assert(sheng_s < sizeof(m512));
|
||||||
u8 raw_succ = trans_for_c[sheng_s];
|
u8 raw_succ = trans_for_c[sheng_s];
|
||||||
if (raw_succ == m->sheng_end - 1) {
|
if (raw_succ == m->sheng_end - 1) {
|
||||||
@ -207,14 +207,14 @@ void next_states64(const NFA *n, u16 s, u16 *t) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (n->type == MCSHENG_64_NFA_8) {
|
} else if (n->type == MCSHENG_64_NFA_8) {
|
||||||
const u8 *succ_table = (const u8 *)((const char *)m + sizeof(mcsheng64));
|
const u8 *succ_table = reinterpret_cast<const u8 *>(reinterpret_cast<const char *>(m) + sizeof(mcsheng64));
|
||||||
for (u16 c = 0; c < N_CHARS; c++) {
|
for (u16 c = 0; c < N_CHARS; c++) {
|
||||||
u32 normal_id = s - m->sheng_end;
|
u32 normal_id = s - m->sheng_end;
|
||||||
t[c] = succ_table[(normal_id << as) + m->remap[c]];
|
t[c] = succ_table[(normal_id << as) + m->remap[c]];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
u16 base_s = s;
|
u16 base_s = s;
|
||||||
const char *winfo_base = (const char *)n + m->sherman_offset;
|
const char *winfo_base = reinterpret_cast<const char *>(n) + m->sherman_offset;
|
||||||
const char *state_base
|
const char *state_base
|
||||||
= winfo_base + SHERMAN_FIXED_SIZE * (s - m->sherman_limit);
|
= winfo_base + SHERMAN_FIXED_SIZE * (s - m->sherman_limit);
|
||||||
|
|
||||||
@ -223,7 +223,7 @@ void next_states64(const NFA *n, u16 s, u16 *t) {
|
|||||||
assert(base_s >= m->sheng_end);
|
assert(base_s >= m->sheng_end);
|
||||||
}
|
}
|
||||||
|
|
||||||
const u16 *succ_table = (const u16 *)((const char *)m
|
const u16 *succ_table = reinterpret_cast<const u16 *>(reinterpret_cast<const char *>(m)
|
||||||
+ sizeof(mcsheng64));
|
+ sizeof(mcsheng64));
|
||||||
for (u16 c = 0; c < N_CHARS; c++) {
|
for (u16 c = 0; c < N_CHARS; c++) {
|
||||||
u32 normal_id = base_s - m->sheng_end;
|
u32 normal_id = base_s - m->sheng_end;
|
||||||
@ -233,15 +233,15 @@ void next_states64(const NFA *n, u16 s, u16 *t) {
|
|||||||
if (s >= m->sherman_limit) {
|
if (s >= m->sherman_limit) {
|
||||||
UNUSED char type = *(state_base + SHERMAN_TYPE_OFFSET);
|
UNUSED char type = *(state_base + SHERMAN_TYPE_OFFSET);
|
||||||
assert(type == SHERMAN_STATE);
|
assert(type == SHERMAN_STATE);
|
||||||
u8 len = *(const u8 *)(SHERMAN_LEN_OFFSET + state_base);
|
u8 len = *(reinterpret_cast<const u8 *>(SHERMAN_LEN_OFFSET + state_base));
|
||||||
const char *chars = state_base + SHERMAN_CHARS_OFFSET;
|
const char *chars = state_base + SHERMAN_CHARS_OFFSET;
|
||||||
const u16 *states = (const u16 *)(state_base
|
const u16 *states = reinterpret_cast<const u16 *>(state_base
|
||||||
+ SHERMAN_STATES_OFFSET(len));
|
+ SHERMAN_STATES_OFFSET(len));
|
||||||
|
|
||||||
for (u8 i = 0; i < len; i++) {
|
for (u8 i = 0; i < len; i++) {
|
||||||
for (u16 c = 0; c < N_CHARS; c++) {
|
for (u16 c = 0; c < N_CHARS; c++) {
|
||||||
if (m->remap[c] == chars[i]) {
|
if (m->remap[c] == chars[i]) {
|
||||||
t[c] = unaligned_load_u16((const u8*)&states[i]);
|
t[c] = unaligned_load_u16(reinterpret_cast<const u8*>(&states[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -324,8 +324,8 @@ void describeNode(const NFA *n, const mcsheng *m, u16 i, FILE *f) {
|
|||||||
"label = \"%u%s\" ]; \n", i, i, isSherman ? "w":"");
|
"label = \"%u%s\" ]; \n", i, i, isSherman ? "w":"");
|
||||||
|
|
||||||
if (aux->accel_offset) {
|
if (aux->accel_offset) {
|
||||||
dumpAccelDot(f, i, (const union AccelAux *)
|
dumpAccelDot(f, i, reinterpret_cast<const union AccelAux *>
|
||||||
((const char *)m + aux->accel_offset));
|
(reinterpret_cast<const char *>(m) + aux->accel_offset));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i && i < m->sheng_end) {
|
if (i && i < m->sheng_end) {
|
||||||
@ -354,14 +354,14 @@ void describeNode(const NFA *n, const mcsheng *m, u16 i, FILE *f) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isSherman) {
|
if (isSherman) {
|
||||||
const char *winfo_base = (const char *)n + m->sherman_offset;
|
const char *winfo_base = reinterpret_cast<const char *>(n) + m->sherman_offset;
|
||||||
const char *state_base
|
const char *state_base
|
||||||
= winfo_base + SHERMAN_FIXED_SIZE * (i - m->sherman_limit);
|
= winfo_base + SHERMAN_FIXED_SIZE * (i - m->sherman_limit);
|
||||||
assert(state_base < (const char *)m + m->length - sizeof(NFA));
|
assert(state_base < reinterpret_cast<const char *>(m) + m->length - sizeof(NFA));
|
||||||
UNUSED u8 type = *(const u8 *)(state_base + SHERMAN_TYPE_OFFSET);
|
UNUSED u8 type = *(reinterpret_cast<const u8 *>(state_base + SHERMAN_TYPE_OFFSET));
|
||||||
assert(type == SHERMAN_STATE);
|
assert(type == SHERMAN_STATE);
|
||||||
fprintf(f, "%u [ fillcolor = lightblue style=filled ];\n", i);
|
fprintf(f, "%u [ fillcolor = lightblue style=filled ];\n", i);
|
||||||
u16 daddy = *(const u16 *)(state_base + SHERMAN_DADDY_OFFSET);
|
u16 daddy = *(reinterpret_cast<const u16 *>(state_base + SHERMAN_DADDY_OFFSET));
|
||||||
if (daddy) {
|
if (daddy) {
|
||||||
fprintf(f, "%u -> %u [ color=royalblue style=dashed weight=0.1]\n",
|
fprintf(f, "%u -> %u [ color=royalblue style=dashed weight=0.1]\n",
|
||||||
i, daddy);
|
i, daddy);
|
||||||
@ -384,8 +384,8 @@ void describeNode64(const NFA *n, const mcsheng64 *m, u16 i, FILE *f) {
|
|||||||
"label = \"%u%s\" ]; \n", i, i, isSherman ? "w":"");
|
"label = \"%u%s\" ]; \n", i, i, isSherman ? "w":"");
|
||||||
|
|
||||||
if (aux->accel_offset) {
|
if (aux->accel_offset) {
|
||||||
dumpAccelDot(f, i, (const union AccelAux *)
|
dumpAccelDot(f, i, reinterpret_cast<const union AccelAux *>
|
||||||
((const char *)m + aux->accel_offset));
|
(reinterpret_cast<const char *>(m) + aux->accel_offset));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i && i < m->sheng_end) {
|
if (i && i < m->sheng_end) {
|
||||||
@ -414,14 +414,14 @@ void describeNode64(const NFA *n, const mcsheng64 *m, u16 i, FILE *f) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isSherman) {
|
if (isSherman) {
|
||||||
const char *winfo_base = (const char *)n + m->sherman_offset;
|
const char *winfo_base = reinterpret_cast<const char *>(n) + m->sherman_offset;
|
||||||
const char *state_base
|
const char *state_base
|
||||||
= winfo_base + SHERMAN_FIXED_SIZE * (i - m->sherman_limit);
|
= winfo_base + SHERMAN_FIXED_SIZE * (i - m->sherman_limit);
|
||||||
assert(state_base < (const char *)m + m->length - sizeof(NFA));
|
assert(state_base < reinterpret_cast<const char *>(m) + m->length - sizeof(NFA));
|
||||||
UNUSED u8 type = *(const u8 *)(state_base + SHERMAN_TYPE_OFFSET);
|
UNUSED u8 type = *(reinterpret_cast<const u8 *>(state_base + SHERMAN_TYPE_OFFSET));
|
||||||
assert(type == SHERMAN_STATE);
|
assert(type == SHERMAN_STATE);
|
||||||
fprintf(f, "%u [ fillcolor = lightblue style=filled ];\n", i);
|
fprintf(f, "%u [ fillcolor = lightblue style=filled ];\n", i);
|
||||||
u16 daddy = *(const u16 *)(state_base + SHERMAN_DADDY_OFFSET);
|
u16 daddy = *(reinterpret_cast<const u16 *>(state_base + SHERMAN_DADDY_OFFSET));
|
||||||
if (daddy) {
|
if (daddy) {
|
||||||
fprintf(f, "%u -> %u [ color=royalblue style=dashed weight=0.1]\n",
|
fprintf(f, "%u -> %u [ color=royalblue style=dashed weight=0.1]\n",
|
||||||
i, daddy);
|
i, daddy);
|
||||||
@ -447,7 +447,7 @@ void dumpDotPreambleDfa(FILE *f) {
|
|||||||
|
|
||||||
static
|
static
|
||||||
void dump_dot_16(const NFA *nfa, FILE *f) {
|
void dump_dot_16(const NFA *nfa, FILE *f) {
|
||||||
auto *m = (const mcsheng *)getImplNfa(nfa);
|
auto *m = reinterpret_cast<const mcsheng *>(getImplNfa(nfa));
|
||||||
|
|
||||||
dumpDotPreambleDfa(f);
|
dumpDotPreambleDfa(f);
|
||||||
|
|
||||||
@ -466,7 +466,7 @@ void dump_dot_16(const NFA *nfa, FILE *f) {
|
|||||||
|
|
||||||
static
|
static
|
||||||
void dump_dot_8(const NFA *nfa, FILE *f) {
|
void dump_dot_8(const NFA *nfa, FILE *f) {
|
||||||
auto m = (const mcsheng *)getImplNfa(nfa);
|
auto m = reinterpret_cast<const mcsheng *>(getImplNfa(nfa));
|
||||||
|
|
||||||
dumpDotPreambleDfa(f);
|
dumpDotPreambleDfa(f);
|
||||||
|
|
||||||
@ -494,7 +494,7 @@ void dumpAccelMasks(FILE *f, const mcsheng *m, const mstate_aux *aux) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto accel = (const AccelAux *)((const char *)m + aux[i].accel_offset);
|
auto accel = reinterpret_cast<const AccelAux *>(reinterpret_cast<const char *>(m) + aux[i].accel_offset);
|
||||||
fprintf(f, "%05hu ", i);
|
fprintf(f, "%05hu ", i);
|
||||||
dumpAccelInfo(f, *accel);
|
dumpAccelInfo(f, *accel);
|
||||||
}
|
}
|
||||||
@ -536,8 +536,8 @@ void dumpCommonHeader(FILE *f, const mcsheng *m) {
|
|||||||
|
|
||||||
static
|
static
|
||||||
void dump_text_16(const NFA *nfa, FILE *f) {
|
void dump_text_16(const NFA *nfa, FILE *f) {
|
||||||
auto *m = (const mcsheng *)getImplNfa(nfa);
|
auto *m = reinterpret_cast<const mcsheng *>(getImplNfa(nfa));
|
||||||
auto *aux = (const mstate_aux *)((const char *)nfa + m->aux_offset);
|
auto *aux = reinterpret_cast<const mstate_aux *>(reinterpret_cast<const char *>(nfa) + m->aux_offset);
|
||||||
|
|
||||||
fprintf(f, "mcsheng 16\n");
|
fprintf(f, "mcsheng 16\n");
|
||||||
dumpCommonHeader(f, m);
|
dumpCommonHeader(f, m);
|
||||||
@ -554,8 +554,8 @@ void dump_text_16(const NFA *nfa, FILE *f) {
|
|||||||
|
|
||||||
static
|
static
|
||||||
void dump_text_8(const NFA *nfa, FILE *f) {
|
void dump_text_8(const NFA *nfa, FILE *f) {
|
||||||
auto m = (const mcsheng *)getImplNfa(nfa);
|
auto m = reinterpret_cast<const mcsheng *>(getImplNfa(nfa));
|
||||||
auto aux = (const mstate_aux *)((const char *)nfa + m->aux_offset);
|
auto aux = reinterpret_cast<const mstate_aux *>(reinterpret_cast<const char *>(nfa) + m->aux_offset);
|
||||||
|
|
||||||
fprintf(f, "mcsheng 8\n");
|
fprintf(f, "mcsheng 8\n");
|
||||||
dumpCommonHeader(f, m);
|
dumpCommonHeader(f, m);
|
||||||
@ -572,7 +572,7 @@ void dump_text_8(const NFA *nfa, FILE *f) {
|
|||||||
|
|
||||||
static
|
static
|
||||||
void dump64_dot_16(const NFA *nfa, FILE *f) {
|
void dump64_dot_16(const NFA *nfa, FILE *f) {
|
||||||
auto *m = (const mcsheng64 *)getImplNfa(nfa);
|
auto *m = reinterpret_cast<const mcsheng64 *>(getImplNfa(nfa));
|
||||||
|
|
||||||
dumpDotPreambleDfa(f);
|
dumpDotPreambleDfa(f);
|
||||||
|
|
||||||
@ -591,7 +591,7 @@ void dump64_dot_16(const NFA *nfa, FILE *f) {
|
|||||||
|
|
||||||
static
|
static
|
||||||
void dump64_dot_8(const NFA *nfa, FILE *f) {
|
void dump64_dot_8(const NFA *nfa, FILE *f) {
|
||||||
auto m = (const mcsheng64 *)getImplNfa(nfa);
|
auto m = reinterpret_cast<const mcsheng64 *>(getImplNfa(nfa));
|
||||||
|
|
||||||
dumpDotPreambleDfa(f);
|
dumpDotPreambleDfa(f);
|
||||||
|
|
||||||
@ -619,7 +619,7 @@ void dumpAccelMasks64(FILE *f, const mcsheng64 *m, const mstate_aux *aux) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto accel = (const AccelAux *)((const char *)m + aux[i].accel_offset);
|
auto accel = reinterpret_cast<const AccelAux *>(reinterpret_cast<const char *>(m) + aux[i].accel_offset);
|
||||||
fprintf(f, "%05hu ", i);
|
fprintf(f, "%05hu ", i);
|
||||||
dumpAccelInfo(f, *accel);
|
dumpAccelInfo(f, *accel);
|
||||||
}
|
}
|
||||||
@ -661,8 +661,8 @@ void dumpCommonHeader64(FILE *f, const mcsheng64 *m) {
|
|||||||
|
|
||||||
static
|
static
|
||||||
void dump64_text_8(const NFA *nfa, FILE *f) {
|
void dump64_text_8(const NFA *nfa, FILE *f) {
|
||||||
auto m = (const mcsheng64 *)getImplNfa(nfa);
|
auto m = reinterpret_cast<const mcsheng64 *>(getImplNfa(nfa));
|
||||||
auto aux = (const mstate_aux *)((const char *)nfa + m->aux_offset);
|
auto aux = reinterpret_cast<const mstate_aux *>(reinterpret_cast<const char *>(nfa) + m->aux_offset);
|
||||||
|
|
||||||
fprintf(f, "mcsheng 64-8\n");
|
fprintf(f, "mcsheng 64-8\n");
|
||||||
dumpCommonHeader64(f, m);
|
dumpCommonHeader64(f, m);
|
||||||
@ -679,8 +679,8 @@ void dump64_text_8(const NFA *nfa, FILE *f) {
|
|||||||
|
|
||||||
static
|
static
|
||||||
void dump64_text_16(const NFA *nfa, FILE *f) {
|
void dump64_text_16(const NFA *nfa, FILE *f) {
|
||||||
auto *m = (const mcsheng64 *)getImplNfa(nfa);
|
auto *m = reinterpret_cast<const mcsheng64 *>(getImplNfa(nfa));
|
||||||
auto *aux = (const mstate_aux *)((const char *)nfa + m->aux_offset);
|
auto *aux = reinterpret_cast<const mstate_aux *>(reinterpret_cast<const char *>(nfa) + m->aux_offset);
|
||||||
|
|
||||||
fprintf(f, "mcsheng 64-16\n");
|
fprintf(f, "mcsheng 64-16\n");
|
||||||
dumpCommonHeader64(f, m);
|
dumpCommonHeader64(f, m);
|
||||||
|
@ -80,9 +80,9 @@ void dumpKilo(FILE *f, const mpv *m, const mpv_kilopuff *k) {
|
|||||||
case MPV_SHUFTI:
|
case MPV_SHUFTI:
|
||||||
fprintf(f, "shufti\n");
|
fprintf(f, "shufti\n");
|
||||||
fprintf(f, "lo %s\n",
|
fprintf(f, "lo %s\n",
|
||||||
dumpMask((const u8 *)&k->u.shuf.mask_lo, 128).c_str());
|
dumpMask(reinterpret_cast<const u8 *>(&k->u.shuf.mask_lo), 128).c_str());
|
||||||
fprintf(f, "hi %s\n",
|
fprintf(f, "hi %s\n",
|
||||||
dumpMask((const u8 *)&k->u.shuf.mask_hi, 128).c_str());
|
dumpMask(reinterpret_cast<const u8 *>(&k->u.shuf.mask_hi), 128).c_str());
|
||||||
break;
|
break;
|
||||||
case MPV_TRUFFLE:
|
case MPV_TRUFFLE:
|
||||||
fprintf(f, "truffle\n");
|
fprintf(f, "truffle\n");
|
||||||
@ -130,7 +130,7 @@ void dumpCounter(FILE *f, const mpv_counter_info *c) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void nfaExecMpv_dump(const NFA *nfa, const string &base) {
|
void nfaExecMpv_dump(const NFA *nfa, const string &base) {
|
||||||
const mpv *m = (const mpv *)getImplNfa(nfa);
|
const mpv *m = reinterpret_cast<const mpv *>(getImplNfa(nfa));
|
||||||
|
|
||||||
StdioFile f(base + ".txt", "w");
|
StdioFile f(base + ".txt", "w");
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ void nfaExecMpv_dump(const NFA *nfa, const string &base) {
|
|||||||
fprintf(f, "initial kilopuffs %u - %u\n", m->top_kilo_begin,
|
fprintf(f, "initial kilopuffs %u - %u\n", m->top_kilo_begin,
|
||||||
m->top_kilo_end - 1);
|
m->top_kilo_end - 1);
|
||||||
|
|
||||||
const mpv_kilopuff *k = (const mpv_kilopuff *)(m + 1);
|
const mpv_kilopuff *k = reinterpret_cast<const mpv_kilopuff *>(m + 1);
|
||||||
for (u32 i = 0; i < m->kilo_count; i++) {
|
for (u32 i = 0; i < m->kilo_count; i++) {
|
||||||
fprintf(f, "\nKILOPUFF %u\n", i);
|
fprintf(f, "\nKILOPUFF %u\n", i);
|
||||||
dumpKilo(f, m, k++);
|
dumpKilo(f, m, k++);
|
||||||
|
@ -195,7 +195,7 @@ enum NFACategory {NFA_LIMEX, NFA_OTHER};
|
|||||||
= "LimEx "#mlt_size; \
|
= "LimEx "#mlt_size; \
|
||||||
template<> struct getDescription<LIMEX_NFA_##mlt_size> { \
|
template<> struct getDescription<LIMEX_NFA_##mlt_size> { \
|
||||||
static string call(const void *p) { \
|
static string call(const void *p) { \
|
||||||
return getDescriptionLimEx<LIMEX_NFA_##mlt_size>((const NFA *)p); \
|
return getDescriptionLimEx<LIMEX_NFA_##mlt_size>(reinterpret_cast<const NFA *>(p)); \
|
||||||
} \
|
} \
|
||||||
};)
|
};)
|
||||||
|
|
||||||
|
@ -53,13 +53,13 @@ static
|
|||||||
const sstate_aux *get_aux(const NFA *n, dstate_id_t i) {
|
const sstate_aux *get_aux(const NFA *n, dstate_id_t i) {
|
||||||
assert(n && isSheng16Type(n->type));
|
assert(n && isSheng16Type(n->type));
|
||||||
|
|
||||||
const sheng *s = (const sheng *)getImplNfa(n);
|
const sheng *s = reinterpret_cast<const sheng *>(getImplNfa(n));
|
||||||
const sstate_aux *aux_base =
|
const sstate_aux *aux_base =
|
||||||
(const sstate_aux *)((const char *)n + s->aux_offset);
|
reinterpret_cast<const sstate_aux *>(reinterpret_cast<const char *>(n) + s->aux_offset);
|
||||||
|
|
||||||
const sstate_aux *aux = aux_base + i;
|
const sstate_aux *aux = aux_base + i;
|
||||||
|
|
||||||
assert((const char *)aux < (const char *)s + s->length);
|
assert(reinterpret_cast<const char *>(aux) < reinterpret_cast<const char *>(s) + s->length);
|
||||||
|
|
||||||
return aux;
|
return aux;
|
||||||
}
|
}
|
||||||
@ -68,13 +68,13 @@ static
|
|||||||
const sstate_aux *get_aux32(const NFA *n, dstate_id_t i) {
|
const sstate_aux *get_aux32(const NFA *n, dstate_id_t i) {
|
||||||
assert(n && isSheng32Type(n->type));
|
assert(n && isSheng32Type(n->type));
|
||||||
|
|
||||||
const sheng32 *s = (const sheng32 *)getImplNfa(n);
|
const sheng32 *s = reinterpret_cast<const sheng32 *>(getImplNfa(n));
|
||||||
const sstate_aux *aux_base =
|
const sstate_aux *aux_base =
|
||||||
(const sstate_aux *)((const char *)n + s->aux_offset);
|
reinterpret_cast<const sstate_aux *>(reinterpret_cast<const char *>(n) + s->aux_offset);
|
||||||
|
|
||||||
const sstate_aux *aux = aux_base + i;
|
const sstate_aux *aux = aux_base + i;
|
||||||
|
|
||||||
assert((const char *)aux < (const char *)s + s->length);
|
assert(reinterpret_cast<const char *>(aux) < reinterpret_cast<const char *>(s) + s->length);
|
||||||
|
|
||||||
return aux;
|
return aux;
|
||||||
}
|
}
|
||||||
@ -83,13 +83,13 @@ static
|
|||||||
const sstate_aux *get_aux64(const NFA *n, dstate_id_t i) {
|
const sstate_aux *get_aux64(const NFA *n, dstate_id_t i) {
|
||||||
assert(n && isSheng64Type(n->type));
|
assert(n && isSheng64Type(n->type));
|
||||||
|
|
||||||
const sheng64 *s = (const sheng64 *)getImplNfa(n);
|
const sheng64 *s = reinterpret_cast<const sheng64 *>(getImplNfa(n));
|
||||||
const sstate_aux *aux_base =
|
const sstate_aux *aux_base =
|
||||||
(const sstate_aux *)((const char *)n + s->aux_offset);
|
reinterpret_cast<const sstate_aux *>(reinterpret_cast<const char *>(n) + s->aux_offset);
|
||||||
|
|
||||||
const sstate_aux *aux = aux_base + i;
|
const sstate_aux *aux = aux_base + i;
|
||||||
|
|
||||||
assert((const char *)aux < (const char *)s + s->length);
|
assert(reinterpret_cast<const char *>(aux) < reinterpret_cast<const char *>(s) + s->length);
|
||||||
|
|
||||||
return aux;
|
return aux;
|
||||||
}
|
}
|
||||||
@ -234,7 +234,7 @@ void dumpMasks64(FILE *f, const sheng64 *s) {
|
|||||||
static
|
static
|
||||||
void nfaExecSheng_dumpText(const NFA *nfa, FILE *f) {
|
void nfaExecSheng_dumpText(const NFA *nfa, FILE *f) {
|
||||||
assert(nfa->type == SHENG_NFA);
|
assert(nfa->type == SHENG_NFA);
|
||||||
const sheng *s = (const sheng *)getImplNfa(nfa);
|
const sheng *s = reinterpret_cast<const sheng *>(getImplNfa(nfa));
|
||||||
|
|
||||||
fprintf(f, "sheng DFA\n");
|
fprintf(f, "sheng DFA\n");
|
||||||
dumpHeader(f, s);
|
dumpHeader(f, s);
|
||||||
@ -245,19 +245,19 @@ void nfaExecSheng_dumpText(const NFA *nfa, FILE *f) {
|
|||||||
if (aux->accept) {
|
if (aux->accept) {
|
||||||
fprintf(f, "report list:\n");
|
fprintf(f, "report list:\n");
|
||||||
const report_list *rl =
|
const report_list *rl =
|
||||||
(const report_list *)((const char *)nfa + aux->accept);
|
reinterpret_cast<const report_list *>(reinterpret_cast<const char *>(nfa) + aux->accept);
|
||||||
dumpReports(f, rl);
|
dumpReports(f, rl);
|
||||||
}
|
}
|
||||||
if (aux->accept_eod) {
|
if (aux->accept_eod) {
|
||||||
fprintf(f, "EOD report list:\n");
|
fprintf(f, "EOD report list:\n");
|
||||||
const report_list *rl =
|
const report_list *rl =
|
||||||
(const report_list *)((const char *)nfa + aux->accept_eod);
|
reinterpret_cast<const report_list *>(reinterpret_cast<const char *>(nfa) + aux->accept_eod);
|
||||||
dumpReports(f, rl);
|
dumpReports(f, rl);
|
||||||
}
|
}
|
||||||
if (aux->accel) {
|
if (aux->accel) {
|
||||||
fprintf(f, "accel:\n");
|
fprintf(f, "accel:\n");
|
||||||
const AccelAux *accel =
|
const AccelAux *accel =
|
||||||
(const AccelAux *)((const char *)nfa + aux->accel);
|
reinterpret_cast<const AccelAux *>(reinterpret_cast<const char *>(nfa) + aux->accel);
|
||||||
dumpAccelInfo(f, *accel);
|
dumpAccelInfo(f, *accel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -272,7 +272,7 @@ void nfaExecSheng_dumpText(const NFA *nfa, FILE *f) {
|
|||||||
static
|
static
|
||||||
void nfaExecSheng32_dumpText(const NFA *nfa, FILE *f) {
|
void nfaExecSheng32_dumpText(const NFA *nfa, FILE *f) {
|
||||||
assert(nfa->type == SHENG_NFA_32);
|
assert(nfa->type == SHENG_NFA_32);
|
||||||
const sheng32 *s = (const sheng32 *)getImplNfa(nfa);
|
const sheng32 *s = reinterpret_cast<const sheng32 *>(getImplNfa(nfa));
|
||||||
|
|
||||||
fprintf(f, "sheng32 DFA\n");
|
fprintf(f, "sheng32 DFA\n");
|
||||||
dumpHeader32(f, s);
|
dumpHeader32(f, s);
|
||||||
@ -283,19 +283,19 @@ void nfaExecSheng32_dumpText(const NFA *nfa, FILE *f) {
|
|||||||
if (aux->accept) {
|
if (aux->accept) {
|
||||||
fprintf(f, "report list:\n");
|
fprintf(f, "report list:\n");
|
||||||
const report_list *rl =
|
const report_list *rl =
|
||||||
(const report_list *)((const char *)nfa + aux->accept);
|
reinterpret_cast<const report_list *>(reinterpret_cast<const char *>(nfa) + aux->accept);
|
||||||
dumpReports(f, rl);
|
dumpReports(f, rl);
|
||||||
}
|
}
|
||||||
if (aux->accept_eod) {
|
if (aux->accept_eod) {
|
||||||
fprintf(f, "EOD report list:\n");
|
fprintf(f, "EOD report list:\n");
|
||||||
const report_list *rl =
|
const report_list *rl =
|
||||||
(const report_list *)((const char *)nfa + aux->accept_eod);
|
reinterpret_cast<const report_list *>(reinterpret_cast<const char *>(nfa) + aux->accept_eod);
|
||||||
dumpReports(f, rl);
|
dumpReports(f, rl);
|
||||||
}
|
}
|
||||||
if (aux->accel) {
|
if (aux->accel) {
|
||||||
fprintf(f, "accel:\n");
|
fprintf(f, "accel:\n");
|
||||||
const AccelAux *accel =
|
const AccelAux *accel =
|
||||||
(const AccelAux *)((const char *)nfa + aux->accel);
|
reinterpret_cast<const AccelAux *>(reinterpret_cast<const char *>(nfa) + aux->accel);
|
||||||
dumpAccelInfo(f, *accel);
|
dumpAccelInfo(f, *accel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -310,7 +310,7 @@ void nfaExecSheng32_dumpText(const NFA *nfa, FILE *f) {
|
|||||||
static
|
static
|
||||||
void nfaExecSheng64_dumpText(const NFA *nfa, FILE *f) {
|
void nfaExecSheng64_dumpText(const NFA *nfa, FILE *f) {
|
||||||
assert(nfa->type == SHENG_NFA_64);
|
assert(nfa->type == SHENG_NFA_64);
|
||||||
const sheng64 *s = (const sheng64 *)getImplNfa(nfa);
|
const sheng64 *s = reinterpret_cast<const sheng64 *>(getImplNfa(nfa));
|
||||||
|
|
||||||
fprintf(f, "sheng64 DFA\n");
|
fprintf(f, "sheng64 DFA\n");
|
||||||
dumpHeader64(f, s);
|
dumpHeader64(f, s);
|
||||||
@ -321,19 +321,19 @@ void nfaExecSheng64_dumpText(const NFA *nfa, FILE *f) {
|
|||||||
if (aux->accept) {
|
if (aux->accept) {
|
||||||
fprintf(f, "report list:\n");
|
fprintf(f, "report list:\n");
|
||||||
const report_list *rl =
|
const report_list *rl =
|
||||||
(const report_list *)((const char *)nfa + aux->accept);
|
reinterpret_cast<const report_list *>(reinterpret_cast<const char *>(nfa) + aux->accept);
|
||||||
dumpReports(f, rl);
|
dumpReports(f, rl);
|
||||||
}
|
}
|
||||||
if (aux->accept_eod) {
|
if (aux->accept_eod) {
|
||||||
fprintf(f, "EOD report list:\n");
|
fprintf(f, "EOD report list:\n");
|
||||||
const report_list *rl =
|
const report_list *rl =
|
||||||
(const report_list *)((const char *)nfa + aux->accept_eod);
|
reinterpret_cast<const report_list *>(reinterpret_cast<const char *>(nfa) + aux->accept_eod);
|
||||||
dumpReports(f, rl);
|
dumpReports(f, rl);
|
||||||
}
|
}
|
||||||
if (aux->accel) {
|
if (aux->accel) {
|
||||||
fprintf(f, "accel:\n");
|
fprintf(f, "accel:\n");
|
||||||
const AccelAux *accel =
|
const AccelAux *accel =
|
||||||
(const AccelAux *)((const char *)nfa + aux->accel);
|
reinterpret_cast<const AccelAux *>(reinterpret_cast<const char *>(nfa) + aux->accel);
|
||||||
dumpAccelInfo(f, *accel);
|
dumpAccelInfo(f, *accel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -487,7 +487,7 @@ void describeEdge(FILE *f, const u16 *t, u16 i) {
|
|||||||
static
|
static
|
||||||
void shengGetTransitions(const NFA *n, u16 state, u16 *t) {
|
void shengGetTransitions(const NFA *n, u16 state, u16 *t) {
|
||||||
assert(isSheng16Type(n->type));
|
assert(isSheng16Type(n->type));
|
||||||
const sheng *s = (const sheng *)getImplNfa(n);
|
const sheng *s = reinterpret_cast<const sheng *>(getImplNfa(n));
|
||||||
const sstate_aux *aux = get_aux(n, state);
|
const sstate_aux *aux = get_aux(n, state);
|
||||||
|
|
||||||
for (unsigned i = 0; i < N_CHARS; i++) {
|
for (unsigned i = 0; i < N_CHARS; i++) {
|
||||||
@ -505,7 +505,7 @@ void shengGetTransitions(const NFA *n, u16 state, u16 *t) {
|
|||||||
static
|
static
|
||||||
void sheng32GetTransitions(const NFA *n, u16 state, u16 *t) {
|
void sheng32GetTransitions(const NFA *n, u16 state, u16 *t) {
|
||||||
assert(isSheng32Type(n->type));
|
assert(isSheng32Type(n->type));
|
||||||
const sheng32 *s = (const sheng32 *)getImplNfa(n);
|
const sheng32 *s = reinterpret_cast<const sheng32 *>(getImplNfa(n));
|
||||||
const sstate_aux *aux = get_aux32(n, state);
|
const sstate_aux *aux = get_aux32(n, state);
|
||||||
|
|
||||||
for (unsigned i = 0; i < N_CHARS; i++) {
|
for (unsigned i = 0; i < N_CHARS; i++) {
|
||||||
@ -523,7 +523,7 @@ void sheng32GetTransitions(const NFA *n, u16 state, u16 *t) {
|
|||||||
static
|
static
|
||||||
void sheng64GetTransitions(const NFA *n, u16 state, u16 *t) {
|
void sheng64GetTransitions(const NFA *n, u16 state, u16 *t) {
|
||||||
assert(isSheng64Type(n->type));
|
assert(isSheng64Type(n->type));
|
||||||
const sheng64 *s = (const sheng64 *)getImplNfa(n);
|
const sheng64 *s = reinterpret_cast<const sheng64 *>(getImplNfa(n));
|
||||||
const sstate_aux *aux = get_aux64(n, state);
|
const sstate_aux *aux = get_aux64(n, state);
|
||||||
|
|
||||||
for (unsigned i = 0; i < N_CHARS; i++) {
|
for (unsigned i = 0; i < N_CHARS; i++) {
|
||||||
@ -541,7 +541,7 @@ void sheng64GetTransitions(const NFA *n, u16 state, u16 *t) {
|
|||||||
static
|
static
|
||||||
void nfaExecSheng_dumpDot(const NFA *nfa, FILE *f) {
|
void nfaExecSheng_dumpDot(const NFA *nfa, FILE *f) {
|
||||||
assert(nfa->type == SHENG_NFA);
|
assert(nfa->type == SHENG_NFA);
|
||||||
const sheng *s = (const sheng *)getImplNfa(nfa);
|
const sheng *s = reinterpret_cast<const sheng *>(getImplNfa(nfa));
|
||||||
|
|
||||||
dumpDotPreambleDfa(f);
|
dumpDotPreambleDfa(f);
|
||||||
|
|
||||||
@ -561,7 +561,7 @@ void nfaExecSheng_dumpDot(const NFA *nfa, FILE *f) {
|
|||||||
static
|
static
|
||||||
void nfaExecSheng32_dumpDot(const NFA *nfa, FILE *f) {
|
void nfaExecSheng32_dumpDot(const NFA *nfa, FILE *f) {
|
||||||
assert(nfa->type == SHENG_NFA_32);
|
assert(nfa->type == SHENG_NFA_32);
|
||||||
const sheng32 *s = (const sheng32 *)getImplNfa(nfa);
|
const sheng32 *s = reinterpret_cast<const sheng32 *>(getImplNfa(nfa));
|
||||||
|
|
||||||
dumpDotPreambleDfa(f);
|
dumpDotPreambleDfa(f);
|
||||||
|
|
||||||
@ -581,7 +581,7 @@ void nfaExecSheng32_dumpDot(const NFA *nfa, FILE *f) {
|
|||||||
static
|
static
|
||||||
void nfaExecSheng64_dumpDot(const NFA *nfa, FILE *f) {
|
void nfaExecSheng64_dumpDot(const NFA *nfa, FILE *f) {
|
||||||
assert(nfa->type == SHENG_NFA_64);
|
assert(nfa->type == SHENG_NFA_64);
|
||||||
const sheng64 *s = (const sheng64 *)getImplNfa(nfa);
|
const sheng64 *s = reinterpret_cast<const sheng64 *>(getImplNfa(nfa));
|
||||||
|
|
||||||
dumpDotPreambleDfa(f);
|
dumpDotPreambleDfa(f);
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ using namespace std;
|
|||||||
namespace ue2 {
|
namespace ue2 {
|
||||||
|
|
||||||
void nfaExecTamarama_dump(const struct NFA *nfa, const string &base) {
|
void nfaExecTamarama_dump(const struct NFA *nfa, const string &base) {
|
||||||
const Tamarama *t = (const Tamarama *)getImplNfa(nfa);
|
const Tamarama *t = reinterpret_cast<const Tamarama *>(getImplNfa(nfa));
|
||||||
|
|
||||||
StdioFile f(base + ".txt", "w");
|
StdioFile f(base + ".txt", "w");
|
||||||
|
|
||||||
@ -65,10 +65,10 @@ void nfaExecTamarama_dump(const struct NFA *nfa, const string &base) {
|
|||||||
fprintf(f, "\n");
|
fprintf(f, "\n");
|
||||||
|
|
||||||
const u32 *subOffset =
|
const u32 *subOffset =
|
||||||
(const u32 *)((const char *)t + sizeof(struct Tamarama) +
|
reinterpret_cast<const u32 *>(reinterpret_cast<const char *>(t) + sizeof(struct Tamarama) +
|
||||||
t->numSubEngines * sizeof(u32));
|
t->numSubEngines * sizeof(u32));
|
||||||
for (u32 i = 0; i < t->numSubEngines; i++) {
|
for (u32 i = 0; i < t->numSubEngines; i++) {
|
||||||
const NFA *sub = (const struct NFA *)((const char *)t + subOffset[i]);
|
const NFA *sub = reinterpret_cast<const struct NFA *>(reinterpret_cast<const char *>(t) + subOffset[i]);
|
||||||
|
|
||||||
stringstream sssub;
|
stringstream sssub;
|
||||||
sssub << base << "_sub_" << i;
|
sssub << base << "_sub_" << i;
|
||||||
|
@ -1112,7 +1112,7 @@ really_inline SuperVector<32> SuperVector<32>::Ones_vshl(uint8_t const N)
|
|||||||
template <>
|
template <>
|
||||||
really_inline SuperVector<32> SuperVector<32>::loadu(void const *ptr)
|
really_inline SuperVector<32> SuperVector<32>::loadu(void const *ptr)
|
||||||
{
|
{
|
||||||
return {SuperVector<32>(_mm256_loadu_si256((const m256 *)ptr))};
|
return {SuperVector<32>(_mm256_loadu_si256(reinterpret_cast<const m256 *>(ptr)))};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
@ -1120,7 +1120,7 @@ really_inline SuperVector<32> SuperVector<32>::load(void const *ptr)
|
|||||||
{
|
{
|
||||||
assert(ISALIGNED_N(ptr, alignof(SuperVector::size)));
|
assert(ISALIGNED_N(ptr, alignof(SuperVector::size)));
|
||||||
ptr = vectorscan_assume_aligned(ptr, SuperVector::size);
|
ptr = vectorscan_assume_aligned(ptr, SuperVector::size);
|
||||||
return {SuperVector<32>(_mm256_load_si256((const m256 *)ptr))};
|
return {SuperVector<32>(_mm256_load_si256(reinterpret_cast<const m256 *>(ptr)))};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
@ -1128,7 +1128,7 @@ really_inline SuperVector<32> SuperVector<32>::loadu_maskz(void const *ptr, uint
|
|||||||
{
|
{
|
||||||
#ifdef HAVE_AVX512
|
#ifdef HAVE_AVX512
|
||||||
u32 mask = (~0ULL) >> (32 - len);
|
u32 mask = (~0ULL) >> (32 - len);
|
||||||
SuperVector<32> v = SuperVector<32>(_mm256_mask_loadu_epi8(Zeroes().u.v256[0], mask, (const m256 *)ptr));
|
SuperVector<32> v = SuperVector<32>(_mm256_mask_loadu_epi8(Zeroes().u.v256[0], mask, reinterpret_cast<const m256 *>(ptr)));
|
||||||
v.print8("v");
|
v.print8("v");
|
||||||
return v;
|
return v;
|
||||||
#else
|
#else
|
||||||
@ -1136,7 +1136,7 @@ really_inline SuperVector<32> SuperVector<32>::loadu_maskz(void const *ptr, uint
|
|||||||
SuperVector<32> mask = Ones_vshr(32 -len);
|
SuperVector<32> mask = Ones_vshr(32 -len);
|
||||||
mask.print8("mask");
|
mask.print8("mask");
|
||||||
(Ones() >> (32 - len)).print8("mask");
|
(Ones() >> (32 - len)).print8("mask");
|
||||||
SuperVector<32> v = SuperVector<32>(_mm256_loadu_si256((const m256 *)ptr));
|
SuperVector<32> v = SuperVector<32>(_mm256_loadu_si256(reinterpret_cast<const m256 *>(ptr)));
|
||||||
v.print8("v");
|
v.print8("v");
|
||||||
return mask & v;
|
return mask & v;
|
||||||
#endif
|
#endif
|
||||||
@ -1762,7 +1762,7 @@ really_inline SuperVector<64> SuperVector<64>::operator<<(uint8_t const N) const
|
|||||||
template <>
|
template <>
|
||||||
really_inline SuperVector<64> SuperVector<64>::loadu(void const *ptr)
|
really_inline SuperVector<64> SuperVector<64>::loadu(void const *ptr)
|
||||||
{
|
{
|
||||||
return {SuperVector<64>(_mm512_loadu_si512((const m512 *)ptr))};
|
return {SuperVector<64>(_mm512_loadu_si512(reinterpret_cast<const m512 *>(ptr)))};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
@ -1770,7 +1770,7 @@ really_inline SuperVector<64> SuperVector<64>::load(void const *ptr)
|
|||||||
{
|
{
|
||||||
assert(ISALIGNED_N(ptr, alignof(SuperVector::size)));
|
assert(ISALIGNED_N(ptr, alignof(SuperVector::size)));
|
||||||
ptr = vectorscan_assume_aligned(ptr, SuperVector::size);
|
ptr = vectorscan_assume_aligned(ptr, SuperVector::size);
|
||||||
return {SuperVector<64>(_mm512_load_si512((const m512 *)ptr))};
|
return {SuperVector<64>(_mm512_load_si512(reinterpret_cast<const m512 *>(ptr)))};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
@ -1778,7 +1778,7 @@ really_inline SuperVector<64> SuperVector<64>::loadu_maskz(void const *ptr, uint
|
|||||||
{
|
{
|
||||||
u64a mask = (~0ULL) >> (64 - len);
|
u64a mask = (~0ULL) >> (64 - len);
|
||||||
DEBUG_PRINTF("mask = %016llx\n", mask);
|
DEBUG_PRINTF("mask = %016llx\n", mask);
|
||||||
SuperVector<64> v = SuperVector<64>(_mm512_mask_loadu_epi8(Zeroes().u.v512[0], mask, (const m512 *)ptr));
|
SuperVector<64> v = SuperVector<64>(_mm512_mask_loadu_epi8(Zeroes().u.v512[0], mask, reinterpret_cast<const m512 *>(ptr)));
|
||||||
v.print8("v");
|
v.print8("v");
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user