sizes[i], MAX_LOOPS / sizes[i], matches[m], false, bench,
[&](MicroBenchmark &b) {
b.chars.set('a');
- ue2::shuftiBuildMasks(b.chars, (u8 *)&b.lo, (u8 *)&b.hi);
+ ue2::shuftiBuildMasks(b.chars, reinterpret_cast<u8 *>(&b.lo), reinterpret_cast<u8 *>(&b.hi));
memset(b.buf.data(), 'b', b.size);
},
[&](MicroBenchmark &b) {
sizes[i], MAX_LOOPS / sizes[i], matches[m], true, bench,
[&](MicroBenchmark &b) {
b.chars.set('a');
- ue2::shuftiBuildMasks(b.chars, (u8 *)&b.lo, (u8 *)&b.hi);
+ ue2::shuftiBuildMasks(b.chars, reinterpret_cast<u8 *>(&b.lo), reinterpret_cast<u8 *>(&b.hi));
memset(b.buf.data(), 'b', b.size);
},
[&](MicroBenchmark &b) {
sizes[i], MAX_LOOPS / sizes[i], matches[m], false, bench,
[&](MicroBenchmark &b) {
b.chars.set('a');
- ue2::truffleBuildMasks(b.chars, (u8 *)&b.lo, (u8 *)&b.hi);
+ ue2::truffleBuildMasks(b.chars, reinterpret_cast<u8 *>(&b.lo), reinterpret_cast<u8 *>(&b.hi));
memset(b.buf.data(), 'b', b.size);
},
[&](MicroBenchmark &b) {
sizes[i], MAX_LOOPS / sizes[i], matches[m], true, bench,
[&](MicroBenchmark &b) {
b.chars.set('a');
- ue2::truffleBuildMasks(b.chars, (u8 *)&b.lo, (u8 *)&b.hi);
+ ue2::truffleBuildMasks(b.chars, reinterpret_cast<u8 *>(&b.lo), reinterpret_cast<u8 *>(&b.hi));
memset(b.buf.data(), 'b', b.size);
},
[&](MicroBenchmark &b) {
sizes[i], MAX_LOOPS / sizes[i], matches[m], false, bench,
[&](MicroBenchmark &b) {
b.chars.set('a');
- ue2::truffleBuildMasks(b.chars, (u8 *)&b.lo, (u8 *)&b.hi);
+ ue2::truffleBuildMasks(b.chars, reinterpret_cast<u8 *>(&b.lo), reinterpret_cast<u8 *>(&b.hi));
memset(b.buf.data(), 'b', b.size);
},
[&](MicroBenchmark &b) {
sizes[i], MAX_LOOPS / sizes[i], matches[m], true, bench,
[&](MicroBenchmark &b) {
b.chars.set('a');
- ue2::truffleBuildMasks(b.chars, (u8 *)&b.lo, (u8 *)&b.hi);
+ ue2::truffleBuildMasks(b.chars, reinterpret_cast<u8 *>(&b.lo), reinterpret_cast<u8 *>(&b.hi));
memset(b.buf.data(), 'b', b.size);
},
[&](MicroBenchmark &b) {
dstAddr = iphdr->ip_dst.s_addr;
// UDP/TCP ports
- const struct udphdr *uh = (const struct udphdr *)
- (((const char *)iphdr) + (iphdr->ip_hl * 4));
+ const struct udphdr *uh = reinterpret_cast<const struct udphdr *>
+ ((reinterpret_cast<const char *>(iphdr)) + (iphdr->ip_hl * 4));
srcPort = uh->uh_sport;
dstPort = uh->uh_dport;
}
int onMatch(unsigned int id, unsigned long long from, unsigned long long to,
unsigned int flags, void *ctx) {
// Our context points to a size_t storing the match count
- size_t *matches = (size_t *)ctx;
+ size_t *matches = static_cast<size_t *>(ctx);
(*matches)++;
return 0; // continue matching
}
}
// Valid TCP or UDP packet
- const struct ip *iphdr = (const struct ip *)(pktData
+ const struct ip *iphdr = reinterpret_cast<const struct ip *>(pktData
+ sizeof(struct ether_header));
- const char *payload = (const char *)pktData + offset;
+ const char *payload = reinterpret_cast<const char *>(pktData) + offset;
size_t id = stream_map.insert(std::make_pair(FiveTuple(iphdr),
stream_map.size())).first->second;
static
bool payloadOffset(const unsigned char *pkt_data, unsigned int *offset,
unsigned int *length) {
- const ip *iph = (const ip *)(pkt_data + sizeof(ether_header));
+ const ip *iph = reinterpret_cast<const ip *>(pkt_data + sizeof(ether_header));
const tcphdr *th = nullptr;
// Ignore packets that aren't IPv4
switch (iph->ip_p) {
case IPPROTO_TCP:
- th = (const tcphdr *)((const char *)iph + ihlen);
+ th = reinterpret_cast<const tcphdr *>(reinterpret_cast<const char *>(iph) + ihlen);
thlen = th->th_off * 4;
break;
case IPPROTO_UDP:
map<unsigned int, unsigned int> &stream_indices) {
unsigned int id = sqlite3_column_int(statement, 0);
unsigned int stream_id = sqlite3_column_int(statement, 1);
- const char *blob = (const char *)sqlite3_column_blob(statement, 2);
+ const char *blob = reinterpret_cast<const char *>(sqlite3_column_blob(statement, 2));
unsigned int bytes = sqlite3_column_bytes(statement, 2);
if (!contains(stream_indices, stream_id)) {
// Mark this segment to be destroyed after this process detaches.
shmctl(hsdb_shmid, IPC_RMID, nullptr);
- err = hs_deserialize_database_at(bytes, len, (hs_database_t *)shmaddr);
+ err = hs_deserialize_database_at(bytes, len, reinterpret_cast<hs_database_t *>(shmaddr));
if (err != HS_SUCCESS) {
printf("Failed to deserialize database into shm: %d\n", err);
- shmdt((const void *)shmaddr);
+ shmdt(reinterpret_cast<const void *>(shmaddr));
goto fini;
}
void release_huge(hs_database_t *db) {
#if defined(HAVE_SHMGET) && defined(SHM_HUGETLB)
if (hsdb_shmid != -1) {
- if (shmdt((const void *)db) != 0) {
+ if (shmdt(reinterpret_cast<const void *>(db)) != 0) {
perror("Detach failure");
}
} else {
/** Run a benchmark over a given engine and corpus in block mode. */
static
void benchBlock(void *context) {
- ThreadContext *ctx = (ThreadContext *)context;
+ ThreadContext *ctx = reinterpret_cast<ThreadContext *>(context);
// Synchronization point
ctx->barrier();
/** Run a benchmark over a given engine and corpus in streaming mode. */
static
void benchStreaming(void *context) {
- ThreadContext *ctx = (ThreadContext *)context;
+ ThreadContext *ctx = reinterpret_cast<ThreadContext *>(context);
vector<StreamInfo> streams = prepStreamingData(ctx);
// Synchronization point
static
void benchStreamingCompress(void *context) {
- ThreadContext *ctx = (ThreadContext *)context;
+ ThreadContext *ctx = reinterpret_cast<ThreadContext *>(context);
vector<StreamInfo> streams = prepStreamingData(ctx);
// Synchronization point
/** Run a benchmark over a given engine and corpus in vectored mode. */
static
void benchVectored(void *context) {
- ThreadContext *ctx = (ThreadContext *)context;
-
+ ThreadContext *ctx = reinterpret_cast<ThreadContext *>(context);
+
vector<VectoredInfo> v_plans = prepVectorData(ctx);
// Synchronization point
struct hs_scratch scratch;
scratch.fdr_conf = NULL;
- fdrExec(fdr.get(), (const u8 *)data, sizeof(data), 0, decentCallback,
+ fdrExec(fdr.get(), reinterpret_cast<const u8 *>(data), sizeof(data), 0, decentCallback,
&scratch, HWLM_ALL_GROUPS);
ASSERT_EQ(3U, matches.size());
struct hs_scratch scratch;
scratch.fdr_conf = NULL;
- fdrExec(fdr.get(), (const u8 *)data, sizeof(data) - 1 /* skip nul */, 0,
+ fdrExec(fdr.get(), reinterpret_cast<const u8 *>(data), sizeof(data) - 1 /* skip nul */, 0,
decentCallback, &scratch, HWLM_ALL_GROUPS);
ASSERT_EQ(4U, matches.size());
struct hs_scratch scratch;
scratch.fdr_conf = NULL;
- fdrExec(fdr.get(), (const u8 *)data, sizeof(data) - 1 /* skip nul */, 0,
+ fdrExec(fdr.get(), reinterpret_cast<const u8 *>(data), sizeof(data) - 1 /* skip nul */, 0,
decentCallback, &scratch, HWLM_ALL_GROUPS);
ASSERT_EQ(1U, matches.size());
struct hs_scratch scratch;
scratch.fdr_conf = NULL;
- fdrExec(fdr.get(), (const u8 *)data, sizeof(data) - 1 /* skip nul */, 0,
+ fdrExec(fdr.get(), reinterpret_cast<const u8 *>(data), sizeof(data) - 1 /* skip nul */, 0,
decentCallback, &scratch, HWLM_ALL_GROUPS);
ASSERT_EQ(3U, matches.size());
struct hs_scratch scratch;
scratch.fdr_conf = NULL;
- fdrExec(fdr.get(), (const u8 *)data, sizeof(data) - 1 /* skip nul */, 0,
+ fdrExec(fdr.get(), reinterpret_cast<const u8 *>(data), sizeof(data) - 1 /* skip nul */, 0,
decentCallback, &scratch, HWLM_ALL_GROUPS);
ASSERT_EQ(1U, matches.size());
expected.push_back(match(1, 1));
expected.push_back(match(2, 1));
- safeExecStreaming(fdr.get(), (const u8 *)"", 0, (const u8 *)"aaar", 4, 0,
+ safeExecStreaming(fdr.get(), reinterpret_cast<const u8 *>(""), 0, reinterpret_cast<const u8 *>("aaar"), 4, 0,
decentCallback, HWLM_ALL_GROUPS);
for (u32 i = 0; i < MIN(expected.size(), matches.size()); i++) {
EXPECT_EQ(expected[i], matches[i]);
expected.push_back(match(6, 1));
expected.push_back(match(8, 10));
- safeExecStreaming(fdr.get(), (const u8 *)"aaar", 4, (const u8 *)"dvark", 5,
+ safeExecStreaming(fdr.get(), reinterpret_cast<const u8 *>("aaar"), 4, reinterpret_cast<const u8 *>("dvark"), 5,
0, decentCallback, HWLM_ALL_GROUPS);
for (u32 i = 0; i < MIN(expected.size(), matches.size()); i++) {
expected.push_back(match(14,2));
expected.push_back(match(15,2));
- safeExecStreaming(fdr.get(), (const u8 *)"foobar", 6,
- (const u8 *)"aardvarkkk", 10, 0, decentCallback,
+ safeExecStreaming(fdr.get(), reinterpret_cast<const u8 *>("foobar"), 6,
+ reinterpret_cast<const u8 *>("aardvarkkk"), 10, 0, decentCallback,
HWLM_ALL_GROUPS);
for (u32 i = 0; i < MIN(expected.size(), matches.size()); i++) {
// bugger up original
for (size_t i = 0 ; i < size; i++) {
- ((char *)fdrTable0.get())[i] = (i % 2) ? 0xCA : 0xFE;
+ (reinterpret_cast<char *>(fdrTable0.get()))[i] = (i % 2) ? 0xCA : 0xFE;
}
// check matches
struct hs_scratch scratch;
scratch.fdr_conf = NULL;
- hwlm_error_t fdrStatus = fdrExec(fdrTable.get(), (const u8 *)data,
+ hwlm_error_t fdrStatus = fdrExec(fdrTable.get(), reinterpret_cast<const u8 *>(data),
data_len, 0, decentCallback, &scratch,
HWLM_ALL_GROUPS);
ASSERT_EQ(0, fdrStatus);
// check matches
- fdrStatus = safeExecStreaming(fdr.get(), (const u8 *)data1, data_len1,
- (const u8 *)data2, data_len2, 0,
+ fdrStatus = safeExecStreaming(fdr.get(), reinterpret_cast<const u8 *>(data1), data_len1,
+ reinterpret_cast<const u8 *>(data2), data_len2, 0,
decentCallback, HWLM_ALL_GROUPS);
ASSERT_EQ(0, fdrStatus);
// allocate aligned buffer
auto dataBufAligned = shared_ptr<char>(
- (char *)aligned_malloc_internal(data_len, buf_alignment),
+ reinterpret_cast<char *>(aligned_malloc_internal(data_len, buf_alignment)),
aligned_free_internal);
vector<hwlmLiteral> lits;
for (size_t j = 0; j <= litLen; j++) {
hwlm_error_t fdrStatus = fdrExec(fdr.get(),
- (const u8 *)dataBufAligned.get() + i + j,
+ reinterpret_cast<const u8 *>(dataBufAligned.get()) + i + j,
4 * buf_alignment - j * 2, 0, decentCallback,
&scratch, HWLM_ALL_GROUPS);
ASSERT_EQ(0, fdrStatus);
const string &buf = bufs[bufIdx];
size_t bufLen = buf.size();
- hwlm_error_t fdrStatus = fdrExec(fdr.get(), (const u8 *)buf.data(),
+ hwlm_error_t fdrStatus = fdrExec(fdr.get(), reinterpret_cast<const u8 *>(buf.data()),
bufLen, 0, decentCallback, &scratch, HWLM_ALL_GROUPS);
ASSERT_EQ(0, fdrStatus);
// check matches
- fdrStatus = safeExecStreaming(fdr.get(), (const u8 *)data1, data_len1,
- (const u8 *)data2, data_len2, 0,
+ fdrStatus = safeExecStreaming(fdr.get(), reinterpret_cast<const u8 *>(data1), data_len1,
+ reinterpret_cast<const u8 *>(data2), data_len2, 0,
decentCallbackT, HWLM_ALL_GROUPS);
ASSERT_EQ(HWLM_TERMINATED, fdrStatus);
struct hs_scratch scratch;
scratch.fdr_conf = NULL;
- fdrStatus = fdrExec(fdr.get(), (const u8 *)data1, data_len1,
+ fdrStatus = fdrExec(fdr.get(), reinterpret_cast<const u8 *>(data1), data_len1,
0, decentCallbackT, &scratch, HWLM_ALL_GROUPS);
ASSERT_EQ(HWLM_TERMINATED, fdrStatus);
static
int onMatch(u64a, u64a, ReportID, void *ctx) {
- unsigned *matches = (unsigned *)ctx;
+ unsigned *matches = reinterpret_cast<unsigned *>(ctx);
(*matches)++;
return MO_CONTINUE_MATCHING;
}
q.state = full_state.get();
q.streamState = stream_state.get();
q.offset = 0;
- q.buffer = (const u8 *)SCAN_DATA.c_str();
+ q.buffer = reinterpret_cast<const u8 *>(SCAN_DATA.c_str());
q.length = SCAN_DATA.size();
q.history = nullptr;
q.hlength = 0;
ASSERT_TRUE(nfa.get() != nullptr);
u64a offset = 0;
- const u8 *buf = (const u8 *)SCAN_DATA.c_str();
+ const u8 *buf = reinterpret_cast<const u8 *>(SCAN_DATA.c_str());
const size_t buflen = SCAN_DATA.size();
const u8 *hbuf = nullptr;
const size_t hlen = 0;
q.state = full_state.get();
q.streamState = stream_state.get();
q.offset = 0;
- q.buffer = (const u8 *)ZOMBIE_SCAN_DATA.c_str();
+ q.buffer = reinterpret_cast<const u8 *>(ZOMBIE_SCAN_DATA.c_str());
q.length = ZOMBIE_SCAN_DATA.length();
q.history = nullptr;
q.hlength = 0;
chars.set('a');
- int ret = shuftiBuildMasks(chars, (u8 *)&lomask, (u8 *)&himask);
+ int ret = shuftiBuildMasks(chars, reinterpret_cast<u8 *>(&lomask), reinterpret_cast<u8 *>(&himask));
ASSERT_NE(-1, ret);
- u8 *lo = (u8 *)&lomask;
- u8 *hi = (u8 *)&himask;
+ u8 *lo = reinterpret_cast<u8 *>(&lomask);
+ u8 *hi = reinterpret_cast<u8 *>(&himask);
for (int i = 0; i < 16; i++) {
if (i == 'a' % 16) {
ASSERT_EQ(1, lo[i]);
chars.set('a');
chars.set('B');
- int ret = shuftiBuildMasks(chars, (u8 *)&lomask, (u8 *)&himask);
+ int ret = shuftiBuildMasks(chars, reinterpret_cast<u8 *>(&lomask), reinterpret_cast<u8 *>(&himask));
ASSERT_NE(-1, ret);
- const u8 *lo = (u8 *)&lomask;
- const u8 *hi = (u8 *)&himask;
+ const u8 *lo = reinterpret_cast<u8 *>(&lomask);
+ const u8 *hi = reinterpret_cast<u8 *>(&himask);
ASSERT_TRUE(lo['a' % 16] & hi['a' >> 4]);
ASSERT_TRUE(lo['B' % 16] & hi['B' >> 4]);
ASSERT_FALSE(lo['a' % 16] & hi['B' >> 4]);
chars.set('A');
chars.set('b');
- int ret = shuftiBuildMasks(chars, (u8 *)&lomask, (u8 *)&himask);
+ int ret = shuftiBuildMasks(chars, reinterpret_cast<u8 *>(&lomask), reinterpret_cast<u8 *>(&himask));
ASSERT_NE(-1, ret);
- const u8 *lo = (u8 *)&lomask;
- const u8 *hi = (u8 *)&himask;
+ const u8 *lo = reinterpret_cast<u8 *>(&lomask);
+ const u8 *hi = reinterpret_cast<u8 *>(&himask);
ASSERT_TRUE(lo['a' % 16] & hi['a' >> 4]);
ASSERT_TRUE(lo['A' % 16] & hi['A' >> 4]);
ASSERT_TRUE(lo['b' % 16] & hi['b' >> 4]);
CharReach chars;
chars.set('a');
- int ret = shuftiBuildMasks(chars, (u8 *)&lo, (u8 *)&hi);
+ int ret = shuftiBuildMasks(chars, reinterpret_cast<u8 *>(&lo), reinterpret_cast<u8 *>(&hi));
ASSERT_NE(-1, ret);
char t1[] = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
for (size_t i = 0; i < 32; i++) {
- const u8 *rv = shuftiExec(lo, hi, (u8 *)t1 + i, (u8 *)t1 + strlen(t1));
+ const u8 *rv = shuftiExec(lo, hi, reinterpret_cast<u8 *>(t1) + i, reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_LE(((size_t)t1 + strlen(t1)) & ~0xf, (size_t)rv);
}
chars.set('a');
chars.set('B');
- int ret = shuftiBuildMasks(chars, (u8 *)&lo, (u8 *)&hi);
+ int ret = shuftiBuildMasks(chars, reinterpret_cast<u8 *>(&lo), reinterpret_cast<u8 *>(&hi));
ASSERT_NE(-1, ret);
char t1[] = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
for (size_t i = 0; i < 16; i++) {
- const u8 *rv = shuftiExec(lo, hi, (u8 *)t1 + i, (u8 *)t1 + strlen(t1));
+ const u8 *rv = shuftiExec(lo, hi, reinterpret_cast<u8 *>(t1) + i, reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_LE(((size_t)t1 + strlen(t1)) & ~0xf, (size_t)rv);
}
CharReach chars;
chars.set('V'); /* V = 0x56, e = 0x65 */
- int ret = shuftiBuildMasks(chars, (u8 *)&lo, (u8 *)&hi);
+ int ret = shuftiBuildMasks(chars, reinterpret_cast<u8 *>(&lo), reinterpret_cast<u8 *>(&hi));
ASSERT_NE(-1, ret);
char t1[] = "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
for (size_t i = 0; i < 16; i++) {
- const u8 *rv = shuftiExec(lo, hi, (u8 *)t1 + i, (u8 *)t1 + strlen(t1));
+ const u8 *rv = shuftiExec(lo, hi, reinterpret_cast<u8 *>(t1) + i, reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_LE(((size_t)t1 + strlen(t1)) & ~0xf, (size_t)rv);
}
CharReach chars;
chars.set('a');
- int ret = shuftiBuildMasks(chars, (u8 *)&lo, (u8 *)&hi);
+ int ret = shuftiBuildMasks(chars, reinterpret_cast<u8 *>(&lo), reinterpret_cast<u8 *>(&hi));
ASSERT_NE(-1, ret);
/* 0123456789012345678901234567890 */
char t1[] = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbabbbbbbbbbbbb";
for (size_t i = 0; i < 32; i++) {
- const u8 *rv = shuftiExec(lo, hi, (u8 *)t1 + i, (u8 *)t1 + strlen(t1));
+ const u8 *rv = shuftiExec(lo, hi, reinterpret_cast<u8 *>(t1) + i, reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)t1 + 33, (size_t)rv);
}
CharReach chars;
chars.set('a');
- int ret = shuftiBuildMasks(chars, (u8 *)&lo, (u8 *)&hi);
+ int ret = shuftiBuildMasks(chars, reinterpret_cast<u8 *>(&lo), reinterpret_cast<u8 *>(&hi));
ASSERT_NE(-1, ret);
/* 0123456789012345678901234567890 */
char t1[] = "bbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbabbbbbbbbbbbb";
for (size_t i = 0; i < 16; i++) {
- const u8 *rv = shuftiExec(lo, hi, (u8 *)t1 + i, (u8 *)t1 + strlen(t1));
+ const u8 *rv = shuftiExec(lo, hi, reinterpret_cast<u8 *>(t1) + i, reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)t1 + 17, (size_t)rv);
}
chars.set('a');
chars.set('B');
- int ret = shuftiBuildMasks(chars, (u8 *)&lo, (u8 *)&hi);
+ int ret = shuftiBuildMasks(chars, reinterpret_cast<u8 *>(&lo), reinterpret_cast<u8 *>(&hi));
ASSERT_NE(-1, ret);
/* 0123456789012345678901234567890 */
char t1[] = "bbbbbbbbbbbbbbbbbBaaaaaaaaaaaaaaabbbbbbbbbbbbbbbabbbbbbbbbbbb";
for (size_t i = 0; i < 16; i++) {
- const u8 *rv = shuftiExec(lo, hi, (u8 *)t1 + i, (u8 *)t1 + strlen(t1));
+ const u8 *rv = shuftiExec(lo, hi, reinterpret_cast<u8 *>(t1) + i, reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)t1 + 17, (size_t)rv);
}
chars.set('A');
chars.set('c');
- int ret = shuftiBuildMasks(chars, (u8 *)&lo, (u8 *)&hi);
+ int ret = shuftiBuildMasks(chars, reinterpret_cast<u8 *>(&lo), reinterpret_cast<u8 *>(&hi));
ASSERT_NE(-1, ret);
/* 0123456789012345678901234567890 */
char t4[] = "bbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbabbbbbbbbbbbb";
for (size_t i = 0; i < 16; i++) {
- const u8 *rv = shuftiExec(lo, hi, (u8 *)t1 + i, (u8 *)t1 + strlen(t1));
+ const u8 *rv = shuftiExec(lo, hi, reinterpret_cast<u8 *>(t1) + i, reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)t1 + 17, (size_t)rv);
- rv = shuftiExec(lo, hi, (u8 *)t2 + i, (u8 *)t2 + strlen(t1));
+ rv = shuftiExec(lo, hi, reinterpret_cast<u8 *>(t2) + i, reinterpret_cast<u8 *>(t2) + strlen(t1));
ASSERT_EQ((size_t)t2 + 17, (size_t)rv);
- rv = shuftiExec(lo, hi, (u8 *)t3 + i, (u8 *)t3 + strlen(t3));
+ rv = shuftiExec(lo, hi, reinterpret_cast<u8 *>(t3) + i, reinterpret_cast<u8 *>(t3) + strlen(t3));
ASSERT_EQ((size_t)t3 + 17, (size_t)rv);
- rv = shuftiExec(lo, hi, (u8 *)t4 + i, (u8 *)t4 + strlen(t4));
+ rv = shuftiExec(lo, hi, reinterpret_cast<u8 *>(t4) + i, reinterpret_cast<u8 *>(t4) + strlen(t4));
ASSERT_EQ((size_t)t4 + 17, (size_t)rv);
}
CharReach chars;
chars.set('a');
- int ret = shuftiBuildMasks(chars, (u8 *)&lo, (u8 *)&hi);
+ int ret = shuftiBuildMasks(chars, reinterpret_cast<u8 *>(&lo), reinterpret_cast<u8 *>(&hi));
ASSERT_NE(-1, ret);
char t1[] = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
for (size_t i = 0; i < 31; i++) {
t1[48 - i] = 'a';
- const u8 *rv = shuftiExec(lo, hi, (u8 *)t1, (u8 *)t1 + strlen(t1));
+ const u8 *rv = shuftiExec(lo, hi, reinterpret_cast<u8 *>(t1), reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)&t1[48 - i], (size_t)rv);
}
lits.insert(make_pair('a', 'B'));
- bool ret = shuftiBuildDoubleMasks(CharReach(), lits, (u8 *)&lo1m, (u8 *)&hi1m,
- (u8 *)&lo2m, (u8 *)&hi2m);
+ bool ret = shuftiBuildDoubleMasks(CharReach(), lits, reinterpret_cast<u8 *>(&lo1m), reinterpret_cast<u8 *>(&hi1m),
+ reinterpret_cast<u8 *>(&lo2m), reinterpret_cast<u8 *>(&hi2m));
ASSERT_TRUE(ret);
- u8 *lo1 = (u8 *)&lo1m;
- u8 *lo2 = (u8 *)&lo2m;
- u8 *hi1 = (u8 *)&hi1m;
- u8 *hi2 = (u8 *)&hi2m;
+ u8 *lo1 = reinterpret_cast<u8 *>(&lo1m);
+ u8 *lo2 = reinterpret_cast<u8 *>(&lo2m);
+ u8 *hi1 = reinterpret_cast<u8 *>(&hi1m);
+ u8 *hi2 = reinterpret_cast<u8 *>(&hi2m);
for (int i = 0; i < 16; i++) {
if (i == 'a' % 16) {
ASSERT_EQ(254, lo1[i]);
lits.insert(make_pair('a','z'));
lits.insert(make_pair('B','z'));
- bool ret = shuftiBuildDoubleMasks(CharReach(), lits, (u8 *)&lo1m, (u8 *)&hi1m,
- (u8 *)&lo2m, (u8 *)&hi2m);
+ bool ret = shuftiBuildDoubleMasks(CharReach(), lits, reinterpret_cast<u8 *>(&lo1m), reinterpret_cast<u8 *>(&hi1m),
+ reinterpret_cast<u8 *>(&lo2m), reinterpret_cast<u8 *>(&hi2m));
ASSERT_TRUE(ret);
- const u8 *lo1 = (u8 *)&lo1m;
- const u8 *lo2 = (u8 *)&lo2m;
- const u8 *hi1 = (u8 *)&hi1m;
- const u8 *hi2 = (u8 *)&hi2m;
+ const u8 *lo1 = reinterpret_cast<u8 *>(&lo1m);
+ const u8 *lo2 = reinterpret_cast<u8 *>(&lo2m);
+ const u8 *hi1 = reinterpret_cast<u8 *>(&hi1m);
+ const u8 *hi2 = reinterpret_cast<u8 *>(&hi2m);
ASSERT_NE(0xff,
lo1['a' % 16] | hi1['a' >> 4] | lo2['z' % 16] | hi2['z' >> 4]);
ASSERT_NE(0xff,
lits.insert(make_pair('A','z'));
lits.insert(make_pair('b','z'));
- bool ret = shuftiBuildDoubleMasks(CharReach(), lits, (u8 *)&lo1m, (u8 *)&hi1m,
- (u8 *)&lo2m, (u8 *)&hi2m);
+ bool ret = shuftiBuildDoubleMasks(CharReach(), lits, reinterpret_cast<u8 *>(&lo1m), reinterpret_cast<u8 *>(&hi1m),
+ reinterpret_cast<u8 *>(&lo2m), reinterpret_cast<u8 *>(&hi2m));
ASSERT_TRUE(ret);
- const u8 *lo1 = (u8 *)&lo1m;
- const u8 *lo2 = (u8 *)&lo2m;
- const u8 *hi1 = (u8 *)&hi1m;
- const u8 *hi2 = (u8 *)&hi2m;
+ const u8 *lo1 = reinterpret_cast<u8 *>(&lo1m);
+ const u8 *lo2 = reinterpret_cast<u8 *>(&lo2m);
+ const u8 *hi1 = reinterpret_cast<u8 *>(&hi1m);
+ const u8 *hi2 = reinterpret_cast<u8 *>(&hi2m);
ASSERT_NE(0xff,
lo1['a' % 16] | hi1['a' >> 4] | lo2['z' % 16] | hi2['z' >> 4]);
ASSERT_NE(0xff,
CharReach bytes;
bytes.set('X');
- bool ret = shuftiBuildDoubleMasks(bytes, lits, (u8 *)&lo1m, (u8 *)&hi1m,
- (u8 *)&lo2m, (u8 *)&hi2m);
+ bool ret = shuftiBuildDoubleMasks(bytes, lits, reinterpret_cast<u8 *>(&lo1m), reinterpret_cast<u8 *>(&hi1m),
+ reinterpret_cast<u8 *>(&lo2m), reinterpret_cast<u8 *>(&hi2m));
ASSERT_TRUE(ret);
- const u8 *lo1 = (u8 *)&lo1m;
- const u8 *lo2 = (u8 *)&lo2m;
- const u8 *hi1 = (u8 *)&hi1m;
- const u8 *hi2 = (u8 *)&hi2m;
+ const u8 *lo1 = reinterpret_cast<u8 *>(&lo1m);
+ const u8 *lo2 = reinterpret_cast<u8 *>(&lo2m);
+ const u8 *hi1 = reinterpret_cast<u8 *>(&hi1m);
+ const u8 *hi2 = reinterpret_cast<u8 *>(&hi2m);
ASSERT_NE(0xff,
lo1['a' % 16] | hi1['a' >> 4] | lo2['z' % 16] | hi2['z' >> 4]);
ASSERT_EQ(0xff,
lits.insert(make_pair('A','x'));
lits.insert(make_pair('b','x'));
- bool ret = shuftiBuildDoubleMasks(CharReach(), lits, (u8 *)&lo1m, (u8 *)&hi1m,
- (u8 *)&lo2m, (u8 *)&hi2m);
+ bool ret = shuftiBuildDoubleMasks(CharReach(), lits, reinterpret_cast<u8 *>(&lo1m), reinterpret_cast<u8 *>(&hi1m),
+ reinterpret_cast<u8 *>(&lo2m), reinterpret_cast<u8 *>(&hi2m));
ASSERT_TRUE(ret);
- const u8 *lo1 = (u8 *)&lo1m;
- const u8 *lo2 = (u8 *)&lo2m;
- const u8 *hi1 = (u8 *)&hi1m;
- const u8 *hi2 = (u8 *)&hi2m;
+ const u8 *lo1 = reinterpret_cast<u8 *>(&lo1m);
+ const u8 *lo2 = reinterpret_cast<u8 *>(&lo2m);
+ const u8 *hi1 = reinterpret_cast<u8 *>(&hi1m);
+ const u8 *hi2 = reinterpret_cast<u8 *>(&hi2m);
ASSERT_NE(0xff,
lo1['a' % 16] | hi1['a' >> 4] | lo2['z' % 16] | hi2['z' >> 4]);
ASSERT_NE(0xff,
lits.insert(make_pair('u','v'));
lits.insert(make_pair('w','x'));
- bool rv = shuftiBuildDoubleMasks(CharReach(), lits, (u8 *)&lo1m, (u8 *)&hi1m,
- (u8 *)&lo2m, (u8 *)&hi2m);
+ bool rv = shuftiBuildDoubleMasks(CharReach(), lits, reinterpret_cast<u8 *>(&lo1m), reinterpret_cast<u8 *>(&hi1m),
+ reinterpret_cast<u8 *>(&lo2m), reinterpret_cast<u8 *>(&hi2m));
ASSERT_FALSE(rv);
}
lits.insert(make_pair('a','b'));
- bool ret = shuftiBuildDoubleMasks(CharReach(), lits, (u8 *)&lo1, (u8 *)&hi1,
- (u8 *)&lo2, (u8 *)&hi2);
+ bool ret = shuftiBuildDoubleMasks(CharReach(), lits, reinterpret_cast<u8 *>(&lo1), reinterpret_cast<u8 *>(&hi1),
+ reinterpret_cast<u8 *>(&lo2), reinterpret_cast<u8 *>(&hi2));
ASSERT_TRUE(ret);
char t1[] = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
for (size_t i = 0; i < 16; i++) {
const u8 *rv = shuftiDoubleExec(lo1, hi1, lo2, hi2,
- (u8 *)t1 + i, (u8 *)t1 + strlen(t1));
+ reinterpret_cast<u8 *>(t1) + i, reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_LE(((size_t)t1 + strlen(t1)) & ~0xf, (size_t)rv);
}
lits.insert(make_pair('b','a'));
- bool ret = shuftiBuildDoubleMasks(CharReach(), lits, (u8 *)&lo1, (u8 *)&hi1,
- (u8 *)&lo2, (u8 *)&hi2);
+ bool ret = shuftiBuildDoubleMasks(CharReach(), lits, reinterpret_cast<u8 *>(&lo1), reinterpret_cast<u8 *>(&hi1),
+ reinterpret_cast<u8 *>(&lo2), reinterpret_cast<u8 *>(&hi2));
ASSERT_TRUE(ret);
char t1[] = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
for (size_t i = 0; i < 16; i++) {
const u8 *rv = shuftiDoubleExec(lo1, hi1, lo2, hi2,
- (u8 *)t1 + i, (u8 *)t1 + strlen(t1));
+ reinterpret_cast<u8 *>(t1) + i, reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_LE((size_t)t1 + i + 15, (size_t)rv);
}
lits.insert(make_pair('a','b'));
lits.insert(make_pair('B','b'));
- bool ret = shuftiBuildDoubleMasks(CharReach(), lits, (u8 *)&lo1, (u8 *)&hi1,
- (u8 *)&lo2, (u8 *)&hi2);
+ bool ret = shuftiBuildDoubleMasks(CharReach(), lits, reinterpret_cast<u8 *>(&lo1), reinterpret_cast<u8 *>(&hi1),
+ reinterpret_cast<u8 *>(&lo2), reinterpret_cast<u8 *>(&hi2));
ASSERT_TRUE(ret);
char t1[] = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
for (size_t i = 0; i < 16; i++) {
const u8 *rv = shuftiDoubleExec(lo1, hi1, lo2, hi2,
- (u8 *)t1 + i, (u8 *)t1 + strlen(t1));
+ reinterpret_cast<u8 *>(t1) + i, reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_LE(((size_t)t1 + strlen(t1)) & ~0xf, (size_t)rv);
}
lits.insert(make_pair('b','a'));
lits.insert(make_pair('b','B'));
- bool ret = shuftiBuildDoubleMasks(CharReach(), lits, (u8 *)&lo1, (u8 *)&hi1,
- (u8 *)&lo2, (u8 *)&hi2);
+ bool ret = shuftiBuildDoubleMasks(CharReach(), lits, reinterpret_cast<u8 *>(&lo1), reinterpret_cast<u8 *>(&hi1),
+ reinterpret_cast<u8 *>(&lo2), reinterpret_cast<u8 *>(&hi2));
ASSERT_TRUE(ret);
char t1[] = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
for (size_t i = 0; i < 16; i++) {
- const u8 *rv = shuftiDoubleExec(lo1, hi1, lo2, hi2, (u8 *)t1 + i,
- (u8 *)t1 + strlen(t1));
+ const u8 *rv = shuftiDoubleExec(lo1, hi1, lo2, hi2, reinterpret_cast<u8 *>(t1) + i,
+ reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_LE((size_t)t1 + i + 15, (size_t)rv);
}
lits.insert(make_pair('V','e'));
- bool ret = shuftiBuildDoubleMasks(CharReach(), lits, (u8 *)&lo1, (u8 *)&hi1,
- (u8 *)&lo2, (u8 *)&hi2);
+ bool ret = shuftiBuildDoubleMasks(CharReach(), lits, reinterpret_cast<u8 *>(&lo1), reinterpret_cast<u8 *>(&hi1),
+ reinterpret_cast<u8 *>(&lo2), reinterpret_cast<u8 *>(&hi2));
ASSERT_TRUE(ret);
char t1[] = "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
for (size_t i = 0; i < 16; i++) {
const u8 *rv = shuftiDoubleExec(lo1, hi1, lo2, hi2,
- (u8 *)t1 + i, (u8 *)t1 + strlen(t1));
+ reinterpret_cast<u8 *>(t1) + i, reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_LE(((size_t)t1 + strlen(t1)) & ~0xf, (size_t)rv);
}
lits.insert(make_pair('e','V'));
- bool ret = shuftiBuildDoubleMasks(CharReach(), lits, (u8 *)&lo1, (u8 *)&hi1,
- (u8 *)&lo2, (u8 *)&hi2);
+ bool ret = shuftiBuildDoubleMasks(CharReach(), lits, reinterpret_cast<u8 *>(&lo1), reinterpret_cast<u8 *>(&hi1),
+ reinterpret_cast<u8 *>(&lo2), reinterpret_cast<u8 *>(&hi2));
ASSERT_TRUE(ret);
char t1[] = "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
for (size_t i = 0; i < 16; i++) {
const u8 *rv = shuftiDoubleExec(lo1, hi1, lo2, hi2,
- (u8 *)t1 + i, (u8 *)t1 + strlen(t1));
+ reinterpret_cast<u8 *>(t1) + i, reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_LE((size_t)t1 + i + 15, (size_t)rv);
}
lits.insert(make_pair('a','b'));
- bool ret = shuftiBuildDoubleMasks(CharReach(), lits, (u8 *)&lo1, (u8 *)&hi1,
- (u8 *)&lo2, (u8 *)&hi2);
+ bool ret = shuftiBuildDoubleMasks(CharReach(), lits, reinterpret_cast<u8 *>(&lo1), reinterpret_cast<u8 *>(&hi1),
+ reinterpret_cast<u8 *>(&lo2), reinterpret_cast<u8 *>(&hi2));
ASSERT_TRUE(ret);
/* 0123456789012345678901234567890 */
for (size_t i = 0; i < 16; i++) {
const u8 *rv = shuftiDoubleExec(lo1, hi1, lo2, hi2,
- (u8 *)t1 + i, (u8 *)t1 + strlen(t1));
+ reinterpret_cast<u8 *>(t1) + i, reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)t1 + 17, (size_t)rv);
}
lits.insert(make_pair('a','b'));
- bool ret = shuftiBuildDoubleMasks(CharReach(), lits, (u8 *)&lo1, (u8 *)&hi1,
- (u8 *)&lo2, (u8 *)&hi2);
+ bool ret = shuftiBuildDoubleMasks(CharReach(), lits, reinterpret_cast<u8 *>(&lo1), reinterpret_cast<u8 *>(&hi1),
+ reinterpret_cast<u8 *>(&lo2), reinterpret_cast<u8 *>(&hi2));
ASSERT_TRUE(ret);
/* 0123456789012345678901234567890 */
for (size_t i = 0; i < 16; i++) {
const u8 *rv = shuftiDoubleExec(lo1, hi1, lo2, hi2,
- (u8 *)t1 + i, (u8 *)t1 + strlen(t1));
+ reinterpret_cast<u8 *>(t1) + i, reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)t1 + 17, (size_t)rv);
}
lits.insert(make_pair('a','a'));
- bool ret = shuftiBuildDoubleMasks(CharReach(), lits, (u8 *)&lo1, (u8 *)&hi1,
- (u8 *)&lo2, (u8 *)&hi2);
+ bool ret = shuftiBuildDoubleMasks(CharReach(), lits, reinterpret_cast<u8 *>(&lo1), reinterpret_cast<u8 *>(&hi1),
+ reinterpret_cast<u8 *>(&lo2), reinterpret_cast<u8 *>(&hi2));
ASSERT_TRUE(ret);
/* 0123456789012345678901234567890 */
for (size_t i = 0; i < 16; i++) {
const u8 *rv = shuftiDoubleExec(lo1, hi1, lo2, hi2,
- (u8 *)t1 + i, (u8 *)t1 + strlen(t1));
+ reinterpret_cast<u8 *>(t1) + i, reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)t1 + 17, (size_t)rv);
}
lits.insert(make_pair('B','a'));
lits.insert(make_pair('a','a'));
- bool ret = shuftiBuildDoubleMasks(CharReach(), lits, (u8 *)&lo1, (u8 *)&hi1,
- (u8 *)&lo2, (u8 *)&hi2);
+ bool ret = shuftiBuildDoubleMasks(CharReach(), lits, reinterpret_cast<u8 *>(&lo1), reinterpret_cast<u8 *>(&hi1),
+ reinterpret_cast<u8 *>(&lo2), reinterpret_cast<u8 *>(&hi2));
ASSERT_TRUE(ret);
/* 0123456789012345678901234567890 */
for (size_t i = 0; i < 16; i++) {
const u8 *rv = shuftiDoubleExec(lo1, hi1, lo2, hi2,
- (u8 *)t1 + i, (u8 *)t1 + strlen(t1));
+ reinterpret_cast<u8 *>(t1) + i, reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)t1 + 17, (size_t)rv);
}
lits.insert(make_pair('C','a'));
lits.insert(make_pair('c','a'));
- bool ret = shuftiBuildDoubleMasks(CharReach(), lits, (u8 *)&lo1, (u8 *)&hi1,
- (u8 *)&lo2, (u8 *)&hi2);
+ bool ret = shuftiBuildDoubleMasks(CharReach(), lits, reinterpret_cast<u8 *>(&lo1), reinterpret_cast<u8 *>(&hi1),
+ reinterpret_cast<u8 *>(&lo2), reinterpret_cast<u8 *>(&hi2));
ASSERT_TRUE(ret);
/* 0123456789012345678901234567890 */
for (size_t i = 0; i < 16; i++) {
const u8 *rv = shuftiDoubleExec(lo1, hi1, lo2, hi2,
- (u8 *)t1 + i, (u8 *)t1 + strlen(t1));
+ reinterpret_cast<u8 *>(t1) + i, reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)t1 + 17, (size_t)rv);
rv = shuftiDoubleExec(lo1, hi1, lo2, hi2,
- (u8 *)t2 + i, (u8 *)t2 + strlen(t2));
+ reinterpret_cast<u8 *>(t2) + i, reinterpret_cast<u8 *>(t2) + strlen(t2));
ASSERT_EQ((size_t)t2 + 17, (size_t)rv);
rv = shuftiDoubleExec(lo1, hi1, lo2, hi2,
- (u8 *)t3+ i, (u8 *)t3 + strlen(t3));
+ reinterpret_cast<u8 *>(t3)+ i, reinterpret_cast<u8 *>(t3) + strlen(t3));
ASSERT_EQ((size_t)t3 + 17, (size_t)rv);
rv = shuftiDoubleExec(lo1, hi1, lo2, hi2,
- (u8 *)t4 + i, (u8 *)t4 + strlen(t4));
+ reinterpret_cast<u8 *>(t4) + i, reinterpret_cast<u8 *>(t4) + strlen(t4));
ASSERT_EQ((size_t)t4 + 17, (size_t)rv);
}
lits.insert(make_pair('a','C'));
lits.insert(make_pair('a','c'));
- bool ret = shuftiBuildDoubleMasks(CharReach(), lits, (u8 *)&lo1, (u8 *)&hi1,
- (u8 *)&lo2, (u8 *)&hi2);
+ bool ret = shuftiBuildDoubleMasks(CharReach(), lits, reinterpret_cast<u8 *>(&lo1), reinterpret_cast<u8 *>(&hi1),
+ reinterpret_cast<u8 *>(&lo2), reinterpret_cast<u8 *>(&hi2));
ASSERT_TRUE(ret);
/* 0123456789012345678901234567890 */
for (size_t i = 0; i < 16; i++) {
const u8 *rv = shuftiDoubleExec(lo1, hi1, lo2, hi2,
- (u8 *)t1 + i, (u8 *)t1 + strlen(t1));
+ reinterpret_cast<u8 *>(t1) + i, reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)t1 + 17, (size_t)rv);
rv = shuftiDoubleExec(lo1, hi1, lo2, hi2,
- (u8 *)t2 + i, (u8 *)t2 + strlen(t2));
+ reinterpret_cast<u8 *>(t2) + i, reinterpret_cast<u8 *>(t2) + strlen(t2));
ASSERT_EQ((size_t)t2 + 17, (size_t)rv);
rv = shuftiDoubleExec(lo1, hi1, lo2, hi2,
- (u8 *)t3+ i, (u8 *)t3 + strlen(t3));
+ reinterpret_cast<u8 *>(t3)+ i, reinterpret_cast<u8 *>(t3) + strlen(t3));
ASSERT_EQ((size_t)t3 + 17, (size_t)rv);
rv = shuftiDoubleExec(lo1, hi1, lo2, hi2,
- (u8 *)t4 + i, (u8 *)t4 + strlen(t4));
+ reinterpret_cast<u8 *>(t4) + i, reinterpret_cast<u8 *>(t4) + strlen(t4));
ASSERT_EQ((size_t)t4 + 17, (size_t)rv);
}
lits.insert(make_pair('a','A'));
- bool ret = shuftiBuildDoubleMasks(CharReach(), lits, (u8 *)&lo1, (u8 *)&hi1,
- (u8 *)&lo2, (u8 *)&hi2);
+ bool ret = shuftiBuildDoubleMasks(CharReach(), lits, reinterpret_cast<u8 *>(&lo1), reinterpret_cast<u8 *>(&hi1),
+ reinterpret_cast<u8 *>(&lo2), reinterpret_cast<u8 *>(&hi2));
ASSERT_TRUE(ret);
char t1[] = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
t1[48 - i] = 'a';
t1[48 - i + 1] = 'A';
const u8 *rv = shuftiDoubleExec(lo1, hi1, lo2, hi2,
- (u8 *)t1, (u8 *)t1 + strlen(t1));
+ reinterpret_cast<u8 *>(t1), reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)&t1[48 - i], (size_t)rv);
}
// just one one-byte literal
onebyte.set('a');
- bool ret = shuftiBuildDoubleMasks(onebyte, twobyte, (u8 *)&lo1, (u8 *)&hi1,
- (u8 *)&lo2, (u8 *)&hi2);
+ bool ret = shuftiBuildDoubleMasks(onebyte, twobyte, reinterpret_cast<u8 *>(&lo1), reinterpret_cast<u8 *>(&hi1),
+ reinterpret_cast<u8 *>(&lo2), reinterpret_cast<u8 *>(&hi2));
ASSERT_TRUE(ret);
char t1[] = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
for (size_t i = 0; i < 31; i++) {
t1[48 - i] = 'a';
const u8 *rv = shuftiDoubleExec(lo1, hi1, lo2, hi2,
- (u8 *)t1, (u8 *)t1 + strlen(t1));
+ reinterpret_cast<u8 *>(t1), reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)&t1[48 - i], (size_t)rv);
}
onebyte.set('a');
twobyte.insert(make_pair('x', 'y'));
- bool ret = shuftiBuildDoubleMasks(onebyte, twobyte, (u8 *)&lo1, (u8 *)&hi1,
- (u8 *)&lo2, (u8 *)&hi2);
+ bool ret = shuftiBuildDoubleMasks(onebyte, twobyte, reinterpret_cast<u8 *>(&lo1), reinterpret_cast<u8 *>(&hi1),
+ reinterpret_cast<u8 *>(&lo2), reinterpret_cast<u8 *>(&hi2));
ASSERT_TRUE(ret);
char t1[] = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
for (size_t i = 0; i < 31; i++) {
t1[48 - i] = 'a';
const u8 *rv = shuftiDoubleExec(lo1, hi1, lo2, hi2,
- (u8 *)t1, (u8 *)t1 + strlen(t1));
+ reinterpret_cast<u8 *>(t1), reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)&t1[48 - i], (size_t)rv);
}
t2[48 - i] = 'x';
t2[48 - i + 1] = 'y';
const u8 *rv = shuftiDoubleExec(lo1, hi1, lo2, hi2,
- (u8 *)t2, (u8 *)t2 + strlen(t1));
+ reinterpret_cast<u8 *>(t2), reinterpret_cast<u8 *>(t2) + strlen(t1));
ASSERT_EQ((size_t)&t2[48 - i], (size_t)rv);
}
onebyte.set('a');
twobyte.insert(make_pair('x', 'y'));
- bool ret = shuftiBuildDoubleMasks(onebyte, twobyte, (u8 *)&lo1, (u8 *)&hi1,
- (u8 *)&lo2, (u8 *)&hi2);
+ bool ret = shuftiBuildDoubleMasks(onebyte, twobyte, reinterpret_cast<u8 *>(&lo1), reinterpret_cast<u8 *>(&hi1),
+ reinterpret_cast<u8 *>(&lo2), reinterpret_cast<u8 *>(&hi2));
ASSERT_TRUE(ret);
const int len = 420;
for (size_t i = 0; i < 400; i++) {
t1[len - i] = 'a';
const u8 *rv = shuftiDoubleExec(lo1, hi1, lo2, hi2,
- (u8 *)t1, (u8 *)t1 + len);
+ reinterpret_cast<u8 *>(t1), reinterpret_cast<u8 *>(t1) + len);
ASSERT_EQ((size_t)&t1[len - i], (size_t)rv);
}
t2[len - i + 1] = 'y';
DEBUG_PRINTF("i = %ld\n", i);
const u8 *rv = shuftiDoubleExec(lo1, hi1, lo2, hi2,
- (u8 *)t2, (u8 *)t2 + len);
+ reinterpret_cast<u8 *>(t2), reinterpret_cast<u8 *>(t2) + len);
- ASSERT_EQ((const u8 *)&t2[len - i], rv);
+ ASSERT_EQ(reinterpret_cast<const u8 *>(&t2[len - i]), rv);
}
}
CharReach chars;
chars.set('a');
- int ret = shuftiBuildMasks(chars, (u8 *)&lo, (u8 *)&hi);
+ int ret = shuftiBuildMasks(chars, reinterpret_cast<u8 *>(&lo), reinterpret_cast<u8 *>(&hi));
ASSERT_NE(-1, ret);
char t[] = " bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
size_t len = strlen(t1);
for (size_t i = 0; i < 16; i++) {
- const u8 *rv = rshuftiExec(lo, hi, (u8 *)t1, (u8 *)t1 + len - i);
- ASSERT_EQ((const u8 *)t, rv);
+ const u8 *rv = rshuftiExec(lo, hi, reinterpret_cast<u8 *>(t1), reinterpret_cast<u8 *>(t1) + len - i);
+ ASSERT_EQ(reinterpret_cast<const u8 *>(t), rv);
}
}
chars.set('a');
chars.set('B');
- int ret = shuftiBuildMasks(chars, (u8 *)&lo, (u8 *)&hi);
+ int ret = shuftiBuildMasks(chars, reinterpret_cast<u8 *>(&lo), reinterpret_cast<u8 *>(&hi));
ASSERT_NE(-1, ret);
char t[] = " bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
size_t len = strlen(t1);
for (size_t i = 0; i < 16; i++) {
- const u8 *rv = rshuftiExec(lo, hi, (u8 *)t1, (u8 *)t1 + len - i);
- ASSERT_EQ((const u8 *)t, rv);
+ const u8 *rv = rshuftiExec(lo, hi, reinterpret_cast<u8 *>(t1), reinterpret_cast<u8 *>(t1) + len - i);
+ ASSERT_EQ(reinterpret_cast<const u8 *>(t), rv);
}
}
CharReach chars;
chars.set('V'); /* V = 0x56, e = 0x65 */
- int ret = shuftiBuildMasks(chars, (u8 *)&lo, (u8 *)&hi);
+ int ret = shuftiBuildMasks(chars, reinterpret_cast<u8 *>(&lo), reinterpret_cast<u8 *>(&hi));
ASSERT_NE(-1, ret);
char t[] = "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
size_t len = strlen(t1);
for (size_t i = 0; i < 16; i++) {
- const u8 *rv = rshuftiExec(lo, hi, (u8 *)t1, (u8 *)t1 + len - i);
- ASSERT_EQ((const u8 *)t, rv);
+ const u8 *rv = rshuftiExec(lo, hi, reinterpret_cast<u8 *>(t1), reinterpret_cast<u8 *>(t1) + len - i);
+ ASSERT_EQ(reinterpret_cast<const u8 *>(t), rv);
}
}
CharReach chars;
chars.set('a');
- int ret = shuftiBuildMasks(chars, (u8 *)&lo, (u8 *)&hi);
+ int ret = shuftiBuildMasks(chars, reinterpret_cast<u8 *>(&lo), reinterpret_cast<u8 *>(&hi));
ASSERT_NE(-1, ret);
/* 0123456789012345678901234567890 */
size_t len = strlen(t1);
for (size_t i = 0; i < 16; i++) {
- const u8 *rv = rshuftiExec(lo, hi, (u8 *)t1, (u8 *)t1 + len - i);
- ASSERT_NE((const u8 *)t1 - 1, rv); // not found
+ const u8 *rv = rshuftiExec(lo, hi, reinterpret_cast<u8 *>(t1), reinterpret_cast<u8 *>(t1) + len - i);
+ ASSERT_NE(reinterpret_cast<const u8 *>(t1) - 1, rv); // not found
EXPECT_EQ('a', (char)*rv);
- ASSERT_EQ((const u8 *)t1 + 17, rv);
+ ASSERT_EQ(reinterpret_cast<const u8 *>(t1) + 17, rv);
}
}
CharReach chars;
chars.set('a');
- int ret = shuftiBuildMasks(chars, (u8 *)&lo, (u8 *)&hi);
+ int ret = shuftiBuildMasks(chars, reinterpret_cast<u8 *>(&lo), reinterpret_cast<u8 *>(&hi));
ASSERT_NE(-1, ret);
/* 0123456789012345678901234567890 */
size_t len = strlen(t1);
for (size_t i = 0; i < 16; i++) {
- const u8 *rv = rshuftiExec(lo, hi, (u8 *)t1, (u8 *)t1 + len - i);
- ASSERT_NE((const u8 *)t1 - 1, rv); // not found
+ const u8 *rv = rshuftiExec(lo, hi, reinterpret_cast<u8 *>(t1), reinterpret_cast<u8 *>(t1) + len - i);
+ ASSERT_NE(reinterpret_cast<const u8 *>(t1) - 1, rv); // not found
EXPECT_EQ('a', (char)*rv);
- ASSERT_EQ((const u8 *)t1 + 32, rv);
+ ASSERT_EQ(reinterpret_cast<const u8 *>(t1) + 32, rv);
}
}
chars.set('a');
chars.set('B');
- int ret = shuftiBuildMasks(chars, (u8 *)&lo, (u8 *)&hi);
+ int ret = shuftiBuildMasks(chars, reinterpret_cast<u8 *>(&lo), reinterpret_cast<u8 *>(&hi));
ASSERT_NE(-1, ret);
/* 0123456789012345678901234567890 */
size_t len = strlen(t1);
for (size_t i = 0; i < 16; i++) {
- const u8 *rv = rshuftiExec(lo, hi, (u8 *)t1, (u8 *)t1 + len - i);
- ASSERT_NE((const u8 *)t1 - 1, rv); // not found
+ const u8 *rv = rshuftiExec(lo, hi, reinterpret_cast<u8 *>(t1), reinterpret_cast<u8 *>(t1) + len - i);
+ ASSERT_NE(reinterpret_cast<const u8 *>(t1) - 1, rv); // not found
EXPECT_EQ('B', (char)*rv);
- ASSERT_EQ((const u8 *)t1 + 32, rv);
+ ASSERT_EQ(reinterpret_cast<const u8 *>(t1) + 32, rv);
}
// check that we match the 'a' bytes as well.
ASSERT_EQ('B', t1[32]);
t1[32] = 'b';
for (size_t i = 0; i < 16; i++) {
- const u8 *rv = rshuftiExec(lo, hi, (u8 *)t1, (u8 *)t1 + len - i);
- ASSERT_NE((const u8 *)t1 - 1, rv); // not found
+ const u8 *rv = rshuftiExec(lo, hi, reinterpret_cast<u8 *>(t1), reinterpret_cast<u8 *>(t1) + len - i);
+ ASSERT_NE(reinterpret_cast<const u8 *>(t1) - 1, rv); // not found
EXPECT_EQ('a', (char)*rv);
- ASSERT_EQ((const u8 *)t1 + 31, rv);
+ ASSERT_EQ(reinterpret_cast<const u8 *>(t1) + 31, rv);
}
}
chars.set('A');
chars.set('c');
- int ret = shuftiBuildMasks(chars, (u8 *)&lo, (u8 *)&hi);
+ int ret = shuftiBuildMasks(chars, reinterpret_cast<u8 *>(&lo), reinterpret_cast<u8 *>(&hi));
ASSERT_NE(-1, ret);
/* 0123456789012345678901234567890 */
size_t len = strlen(t1);
for (size_t i = 0; i < 16; i++) {
- const u8 *rv = rshuftiExec(lo, hi, (u8 *)t1, (u8 *)t1 + len - i);
+ const u8 *rv = rshuftiExec(lo, hi, reinterpret_cast<u8 *>(t1), reinterpret_cast<u8 *>(t1) + len - i);
EXPECT_EQ('A', (char)*rv);
- ASSERT_EQ((const u8 *)t1 + 32, rv);
+ ASSERT_EQ(reinterpret_cast<const u8 *>(t1) + 32, rv);
- rv = rshuftiExec(lo, hi, (u8 *)t2, (u8 *)t2 + len - i);
+ rv = rshuftiExec(lo, hi, reinterpret_cast<u8 *>(t2), reinterpret_cast<u8 *>(t2) + len - i);
EXPECT_EQ('C', (char)*rv);
- ASSERT_EQ((const u8 *)t2 + 32, rv);
+ ASSERT_EQ(reinterpret_cast<const u8 *>(t2) + 32, rv);
- rv = rshuftiExec(lo, hi, (u8 *)t3, (u8 *)t3 + len - i);
+ rv = rshuftiExec(lo, hi, reinterpret_cast<u8 *>(t3), reinterpret_cast<u8 *>(t3) + len - i);
EXPECT_EQ('c', (char)*rv);
- ASSERT_EQ((const u8 *)t3 + 32, rv);
+ ASSERT_EQ(reinterpret_cast<const u8 *>(t3) + 32, rv);
- rv = rshuftiExec(lo, hi, (u8 *)t4, (u8 *)t4 + len - i);
+ rv = rshuftiExec(lo, hi, reinterpret_cast<u8 *>(t4), reinterpret_cast<u8 *>(t4) + len - i);
EXPECT_EQ('a', (char)*rv);
- ASSERT_EQ((const u8 *)t4 + 32, rv);
+ ASSERT_EQ(reinterpret_cast<const u8 *>(t4) + 32, rv);
}
}
CharReach chars;
chars.set('a');
- int ret = shuftiBuildMasks(chars, (u8 *)&lo, (u8 *)&hi);
+ int ret = shuftiBuildMasks(chars, reinterpret_cast<u8 *>(&lo), reinterpret_cast<u8 *>(&hi));
ASSERT_NE(-1, ret);
char t1[] = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
for (size_t i = 0; i < len; i++) {
t1[i] = 'a';
- const u8 *rv = rshuftiExec(lo, hi, (u8 *)t1, (u8 *)t1 + len);
+ const u8 *rv = rshuftiExec(lo, hi, reinterpret_cast<u8 *>(t1), reinterpret_cast<u8 *>(t1) + len);
- ASSERT_EQ((const u8 *)t1 + i, rv);
+ ASSERT_EQ(reinterpret_cast<const u8 *>(t1) + i, rv);
}
}
CharReach chars;
chars.set('a');
- int ret = shuftiBuildMasks(chars, (u8 *)&lo, (u8 *)&hi);
+ int ret = shuftiBuildMasks(chars, reinterpret_cast<u8 *>(&lo), reinterpret_cast<u8 *>(&hi));
ASSERT_NE(-1, ret);
const size_t len = 256;
for (size_t i = 0; i < len; i++) {
t1[i] = 'a';
DEBUG_PRINTF("i=%ld\n", i);
- const u8 *rv = rshuftiExec(lo, hi, (u8 *)t1, (u8 *)t1 + len);
+ const u8 *rv = rshuftiExec(lo, hi, reinterpret_cast<u8 *>(t1), reinterpret_cast<u8 *>(t1) + len);
- ASSERT_EQ((const u8 *)t1 + i, rv);
+ ASSERT_EQ(reinterpret_cast<const u8 *>(t1) + i, rv);
}
}
chars.setall();
- truffleBuildMasks(chars, (u8 *)&mask1, (u8 *)&mask2);
+ truffleBuildMasks(chars, reinterpret_cast<u8 *>(&mask1), reinterpret_cast<u8 *>(&mask2));
- CharReach out = truffle2cr((u8 *)&mask1, (u8 *)&mask2);
+ CharReach out = truffle2cr(reinterpret_cast<u8 *>(&mask1), reinterpret_cast<u8 *>(&mask2));
ASSERT_EQ(out, chars);
mask2 = zeroes128();
chars.clear();
chars.set((u8)c);
- truffleBuildMasks(chars, (u8 *)&mask1, (u8 *)&mask2);
- CharReach out = truffle2cr((u8 *)&mask1, (u8 *)&mask2);
+ truffleBuildMasks(chars, reinterpret_cast<u8 *>(&mask1), reinterpret_cast<u8 *>(&mask2));
+ CharReach out = truffle2cr(reinterpret_cast<u8 *>(&mask1), reinterpret_cast<u8 *>(&mask2));
ASSERT_EQ(out, chars);
}
mask1 = zeroes128();
mask2 = zeroes128();
chars.set((u8)c);
- truffleBuildMasks(chars, (u8 *)&mask1, (u8 *)&mask2);
- CharReach out = truffle2cr((u8 *)&mask1, (u8 *)&mask2);
+ truffleBuildMasks(chars, reinterpret_cast<u8 *>(&mask1), reinterpret_cast<u8 *>(&mask2));
+ CharReach out = truffle2cr(reinterpret_cast<u8 *>(&mask1), reinterpret_cast<u8 *>(&mask2));
ASSERT_EQ(out, chars);
}
mask1 = zeroes128();
mask2 = zeroes128();
chars.clear((u8)c);
- truffleBuildMasks(chars, (u8 *)&mask1, (u8 *)&mask2);
- CharReach out = truffle2cr((u8 *)&mask1, (u8 *)&mask2);
+ truffleBuildMasks(chars, reinterpret_cast<u8 *>(&mask1), reinterpret_cast<u8 *>(&mask2));
+ CharReach out = truffle2cr(reinterpret_cast<u8 *>(&mask1), reinterpret_cast<u8 *>(&mask2));
ASSERT_EQ(out, chars);
}
chars.set('a');
- truffleBuildMasks(chars, (u8 *)&mask1, (u8 *)&mask2);
+ truffleBuildMasks(chars, reinterpret_cast<u8 *>(&mask1), reinterpret_cast<u8 *>(&mask2));
char t1[] = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\xff";
for (size_t i = 0; i < 16; i++) {
- const u8 *rv = truffleExec(mask1, mask2, (u8 *)t1 + i, (u8 *)t1 + strlen(t1));
+ const u8 *rv = truffleExec(mask1, mask2, reinterpret_cast<u8 *>(t1) + i, reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)t1 + strlen(t1), (size_t)rv);
}
chars.set('a');
chars.set('B');
- truffleBuildMasks(chars, (u8 *)&mask1, (u8 *)&mask2);
+ truffleBuildMasks(chars, reinterpret_cast<u8 *>(&mask1), reinterpret_cast<u8 *>(&mask2));
char t1[] = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
for (size_t i = 0; i < 16; i++) {
- const u8 *rv = truffleExec(mask1, mask2, (u8 *)t1 + i, (u8 *)t1 + strlen(t1));
+ const u8 *rv = truffleExec(mask1, mask2, reinterpret_cast<u8 *>(t1) + i, reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)t1 + strlen(t1), (size_t)rv);
}
chars.set('V'); /* V = 0x56, e = 0x65 */
- truffleBuildMasks(chars, (u8 *)&mask1, (u8 *)&mask2);
+ truffleBuildMasks(chars, reinterpret_cast<u8 *>(&mask1), reinterpret_cast<u8 *>(&mask2));
char t1[] = "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
for (size_t i = 0; i < 16; i++) {
- const u8 *rv = truffleExec(mask1, mask2, (u8 *)t1 + i, (u8 *)t1 + strlen(t1));
+ const u8 *rv = truffleExec(mask1, mask2, reinterpret_cast<u8 *>(t1) + i, reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)t1 + strlen(t1), (size_t)rv);
}
CharReach chars;
chars.set('a');
- truffleBuildMasks(chars, (u8 *)&lo, (u8 *)&hi);
+ truffleBuildMasks(chars, reinterpret_cast<u8 *>(&lo), reinterpret_cast<u8 *>(&hi));
char t1[] = "a";
- const u8 *rv = truffleExec(lo, hi, (u8 *)t1, (u8 *)t1 + strlen(t1));
+ const u8 *rv = truffleExec(lo, hi, reinterpret_cast<u8 *>(t1), reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)t1, (size_t)rv);
}
CharReach chars;
chars.set('a');
- truffleBuildMasks(chars, (u8 *)&lo, (u8 *)&hi);
+ truffleBuildMasks(chars, reinterpret_cast<u8 *>(&lo), reinterpret_cast<u8 *>(&hi));
char t1[] = "bbbbbbbabbb";
- const u8 *rv = truffleExec(lo, hi, (u8 *)t1, (u8 *)t1 + strlen(t1));
+ const u8 *rv = truffleExec(lo, hi, reinterpret_cast<u8 *>(t1), reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)t1 + 7, (size_t)rv);
}
CharReach chars;
chars.set(0);
- truffleBuildMasks(chars, (u8 *)&lo, (u8 *)&hi);
+ truffleBuildMasks(chars, reinterpret_cast<u8 *>(&lo), reinterpret_cast<u8 *>(&hi));
char t1[] = "bbbbbbb\0bbb";
- const u8 *rv = truffleExec(lo, hi, (u8 *)t1, (u8 *)t1 + 11);
+ const u8 *rv = truffleExec(lo, hi, reinterpret_cast<u8 *>(t1), reinterpret_cast<u8 *>(t1) + 11);
ASSERT_EQ((size_t)t1 + 7, (size_t)rv);
}
CharReach chars;
chars.set('a');
- truffleBuildMasks(chars, (u8 *)&lo, (u8 *)&hi);
+ truffleBuildMasks(chars, reinterpret_cast<u8 *>(&lo), reinterpret_cast<u8 *>(&hi));
char t1[] = "\0\0\0\0\0\0\0a\0\0\0";
- const u8 *rv = truffleExec(lo, hi, (u8 *)t1, (u8 *)t1 + 11);
+ const u8 *rv = truffleExec(lo, hi, reinterpret_cast<u8 *>(t1), reinterpret_cast<u8 *>(t1) + 11);
ASSERT_EQ((size_t)t1 + 7, (size_t)rv);
}
CharReach chars;
chars.set('a');
- truffleBuildMasks(chars, (u8 *)&lo, (u8 *)&hi);
+ truffleBuildMasks(chars, reinterpret_cast<u8 *>(&lo), reinterpret_cast<u8 *>(&hi));
std::array<u8, 400> t1;
t1.fill('b');
t1[120] = 'a';
for (size_t i = 0; i < 16; i++) {
- const u8 *rv = truffleExec(lo, hi, (u8 *)t1.data() + i, (u8 *)t1.data() + 399);
+ const u8 *rv = truffleExec(lo, hi, reinterpret_cast<u8 *>(t1.data()) + i, reinterpret_cast<u8 *>(t1.data()) + 399);
ASSERT_LE(((size_t)t1.data() + 120) & ~0xf, (size_t)rv);
}
chars.set('a');
- truffleBuildMasks(chars, (u8 *)&mask1, (u8 *)&mask2);
+ truffleBuildMasks(chars, reinterpret_cast<u8 *>(&mask1), reinterpret_cast<u8 *>(&mask2));
/* 0123456789012345678901234567890 */
char t1[] = "bbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbb";
for (size_t i = 0; i < 16; i++) {
- const u8 *rv = truffleExec(mask1, mask2, (u8 *)t1 + i, (u8 *)t1 + strlen(t1));
+ const u8 *rv = truffleExec(mask1, mask2, reinterpret_cast<u8 *>(t1) + i, reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)t1 + 17, (size_t)rv);
}
chars.set('a');
- truffleBuildMasks(chars, (u8 *)&mask1, (u8 *)&mask2);
+ truffleBuildMasks(chars, reinterpret_cast<u8 *>(&mask1), reinterpret_cast<u8 *>(&mask2));
/* 0123456789012345678901234567890 */
char t1[] = "bbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbabbbbbbbbbbbb";
for (size_t i = 0; i < 16; i++) {
- const u8 *rv = truffleExec(mask1, mask2, (u8 *)t1 + i, (u8 *)t1 + strlen(t1));
+ const u8 *rv = truffleExec(mask1, mask2, reinterpret_cast<u8 *>(t1) + i, reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)t1 + 17, (size_t)rv);
}
chars.set('a');
chars.set('B');
- truffleBuildMasks(chars, (u8 *)&mask1, (u8 *)&mask2);
+ truffleBuildMasks(chars, reinterpret_cast<u8 *>(&mask1), reinterpret_cast<u8 *>(&mask2));
/* 0123456789012345678901234567890 */
char t1[] = "bbbbbbbbbbbbbbbbbBaaaaaaaaaaaaaaabbbbbbbbbbbbbbbabbbbbbbbbbbb";
for (size_t i = 0; i < 16; i++) {
- const u8 *rv = truffleExec(mask1, mask2, (u8 *)t1 + i, (u8 *)t1 + strlen(t1));
+ const u8 *rv = truffleExec(mask1, mask2, reinterpret_cast<u8 *>(t1) + i, reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)t1 + 17, (size_t)rv);
}
chars.set('A');
chars.set('c');
- truffleBuildMasks(chars, (u8 *)&mask1, (u8 *)&mask2);
+ truffleBuildMasks(chars, reinterpret_cast<u8 *>(&mask1), reinterpret_cast<u8 *>(&mask2));
/* 0123456789012345678901234567890 */
char t1[] = "bbbbbbbbbbbbbbbbbAaaaaaaaaaaaaaaabbbbbbbbbbbbbbbabbbbbbbbbbbb";
char t4[] = "bbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbabbbbbbbbbbbb";
for (size_t i = 0; i < 16; i++) {
- const u8 *rv = truffleExec(mask1, mask2, (u8 *)t1 + i, (u8 *)t1 + strlen(t1));
+ const u8 *rv = truffleExec(mask1, mask2, reinterpret_cast<u8 *>(t1) + i, reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)t1 + 17, (size_t)rv);
- rv = truffleExec(mask1, mask2, (u8 *)t2 + i, (u8 *)t2 + strlen(t1));
+ rv = truffleExec(mask1, mask2, reinterpret_cast<u8 *>(t2) + i, reinterpret_cast<u8 *>(t2) + strlen(t1));
ASSERT_EQ((size_t)t2 + 17, (size_t)rv);
- rv = truffleExec(mask1, mask2, (u8 *)t3 + i, (u8 *)t3 + strlen(t3));
+ rv = truffleExec(mask1, mask2, reinterpret_cast<u8 *>(t3) + i, reinterpret_cast<u8 *>(t3) + strlen(t3));
ASSERT_EQ((size_t)t3 + 17, (size_t)rv);
- rv = truffleExec(mask1, mask2, (u8 *)t4 + i, (u8 *)t4 + strlen(t4));
+ rv = truffleExec(mask1, mask2, reinterpret_cast<u8 *>(t4) + i, reinterpret_cast<u8 *>(t4) + strlen(t4));
ASSERT_EQ((size_t)t4 + 17, (size_t)rv);
}
chars.set('a');
- truffleBuildMasks(chars, (u8 *)&mask1, (u8 *)&mask2);
+ truffleBuildMasks(chars, reinterpret_cast<u8 *>(&mask1), reinterpret_cast<u8 *>(&mask2));
char t1[] = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
for (size_t i = 0; i < 31; i++) {
t1[48 - i] = 'a';
- const u8 *rv = truffleExec(mask1, mask2, (u8 *)t1, (u8 *)t1 + strlen(t1));
+ const u8 *rv = truffleExec(mask1, mask2, reinterpret_cast<u8 *>(t1), reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)&t1[48 - i], (size_t)rv);
}
// [0-Z] - includes some graph chars
chars.setRange('0', 'Z');
- truffleBuildMasks(chars, (u8 *)&mask1, (u8 *)&mask2);
+ truffleBuildMasks(chars, reinterpret_cast<u8 *>(&mask1), reinterpret_cast<u8 *>(&mask2));
std::array<u8, 128> t1;
t1.fill('*'); // it's full of stars!
for (u8 c = '0'; c <= 'Z'; c++) {
t1[17] = c;
- const u8 *rv = truffleExec(mask1, mask2, (u8 *)t1.data(), (u8 *)t1.data() + 128);
+ const u8 *rv = truffleExec(mask1, mask2, reinterpret_cast<u8 *>(t1.data()), reinterpret_cast<u8 *>(t1.data()) + 128);
ASSERT_EQ((size_t)t1.data() + 17, (size_t)rv);
}
// hi bits
chars.setRange(127, 255);
- truffleBuildMasks(chars, (u8 *)&mask1, (u8 *)&mask2);
+ truffleBuildMasks(chars, reinterpret_cast<u8 *>(&mask1), reinterpret_cast<u8 *>(&mask2));
std::array<u8, 128> t1;
t1.fill('*'); // it's full of stars!
for (unsigned int c = 127; c <= 255; c++) {
t1[40] = (u8)c;
- const u8 *rv = truffleExec(mask1, mask2, (u8 *)t1.data(), (u8 *)t1.data() + 128);
+ const u8 *rv = truffleExec(mask1, mask2, reinterpret_cast<u8 *>(t1.data()), reinterpret_cast<u8 *>(t1.data()) + 128);
ASSERT_EQ((size_t)t1.data() + 40, (size_t)rv);
}
CharReach chars;
chars.set('a');
- truffleBuildMasks(chars, (u8 *)&mask1, (u8 *)&mask2);
+ truffleBuildMasks(chars, reinterpret_cast<u8 *>(&mask1), reinterpret_cast<u8 *>(&mask2));
char t[] = " bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
char *t1 = t + 1;
size_t len = strlen(t1);
for (size_t i = 0; i < 16; i++) {
- const u8 *rv = rtruffleExec(mask1, mask2, (u8 *)t1, (u8 *)t1 + len - i);
- ASSERT_EQ((const u8 *)t, rv);
+ const u8 *rv = rtruffleExec(mask1, mask2, reinterpret_cast<u8 *>(t1), reinterpret_cast<u8 *>(t1) + len - i);
+ ASSERT_EQ(reinterpret_cast<const u8 *>(t), rv);
}
}
chars.set('a');
chars.set('B');
- truffleBuildMasks(chars, (u8 *)&mask1, (u8 *)&mask2);
+ truffleBuildMasks(chars, reinterpret_cast<u8 *>(&mask1), reinterpret_cast<u8 *>(&mask2));
char t[] = " bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
char *t1 = t + 1;
size_t len = strlen(t1);
for (size_t i = 0; i < 16; i++) {
- const u8 *rv = rtruffleExec(mask1, mask2, (u8 *)t1, (u8 *)t1 + len - i);
- ASSERT_EQ((const u8 *)t, rv);
+ const u8 *rv = rtruffleExec(mask1, mask2, reinterpret_cast<u8 *>(t1), reinterpret_cast<u8 *>(t1) + len - i);
+ ASSERT_EQ(reinterpret_cast<const u8 *>(t), rv);
}
}
CharReach chars;
chars.set('V'); /* V = 0x56, e = 0x65 */
- truffleBuildMasks(chars, (u8 *)&mask1, (u8 *)&mask2);
+ truffleBuildMasks(chars, reinterpret_cast<u8 *>(&mask1), reinterpret_cast<u8 *>(&mask2));
char t[] = "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
char *t1 = t + 1;
size_t len = strlen(t1);
for (size_t i = 0; i < 16; i++) {
- const u8 *rv = rtruffleExec(mask1, mask2, (u8 *)t1, (u8 *)t1 + len - i);
- ASSERT_EQ((const u8 *)t, rv);
+ const u8 *rv = rtruffleExec(mask1, mask2, reinterpret_cast<u8 *>(t1), reinterpret_cast<u8 *>(t1) + len - i);
+ ASSERT_EQ(reinterpret_cast<const u8 *>(t), rv);
}
}
CharReach chars;
chars.set('a');
- truffleBuildMasks(chars, (u8 *)&lo, (u8 *)&hi);
+ truffleBuildMasks(chars, reinterpret_cast<u8 *>(&lo), reinterpret_cast<u8 *>(&hi));
char t1[] = "a";
- const u8 *rv = rtruffleExec(lo, hi, (u8 *)t1, (u8 *)t1 + strlen(t1));
+ const u8 *rv = rtruffleExec(lo, hi, reinterpret_cast<u8 *>(t1), reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)t1, (size_t)rv);
}
CharReach chars;
chars.set('a');
- truffleBuildMasks(chars, (u8 *)&mask1, (u8 *)&mask2);
+ truffleBuildMasks(chars, reinterpret_cast<u8 *>(&mask1), reinterpret_cast<u8 *>(&mask2));
/* 0123456789012345678901234567890 */
char t1[] = "bbbbbbbabbbb";
size_t len = strlen(t1);
- const u8 *rv = rtruffleExec(mask1, mask2, (u8 *)t1, (u8 *)t1 + len);
- ASSERT_NE((const u8 *)t1 - 1, rv); // not found
+ const u8 *rv = rtruffleExec(mask1, mask2, reinterpret_cast<u8 *>(t1), reinterpret_cast<u8 *>(t1) + len);
+ ASSERT_NE(reinterpret_cast<const u8 *>(t1) - 1, rv); // not found
EXPECT_EQ('a', (char)*rv);
- ASSERT_EQ((const u8 *)t1 + 7, rv);
+ ASSERT_EQ(reinterpret_cast<const u8 *>(t1) + 7, rv);
}
TEST(ReverseTruffle, ExecMiniMatch2) {
CharReach chars;
chars.set('a');
- truffleBuildMasks(chars, (u8 *)&mask1, (u8 *)&mask2);
+ truffleBuildMasks(chars, reinterpret_cast<u8 *>(&mask1), reinterpret_cast<u8 *>(&mask2));
/* 0123456789012345678901234567890 */
char t1[] = "babbbbbabbbb";
size_t len = strlen(t1);
- const u8 *rv = rtruffleExec(mask1, mask2, (u8 *)t1, (u8 *)t1 + len);
- ASSERT_NE((const u8 *)t1 - 1, rv); // not found
+ const u8 *rv = rtruffleExec(mask1, mask2, reinterpret_cast<u8 *>(t1), reinterpret_cast<u8 *>(t1) + len);
+ ASSERT_NE(reinterpret_cast<const u8 *>(t1) - 1, rv); // not found
EXPECT_EQ('a', (char)*rv);
- ASSERT_EQ((const u8 *)t1 + 7, rv);
+ ASSERT_EQ(reinterpret_cast<const u8 *>(t1) + 7, rv);
}
CharReach chars;
chars.set('a');
- truffleBuildMasks(chars, (u8 *)&mask1, (u8 *)&mask2);
+ truffleBuildMasks(chars, reinterpret_cast<u8 *>(&mask1), reinterpret_cast<u8 *>(&mask2));
/* 0123456789012345678901234567890 */
char t1[] = "bbbbbbabbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
size_t len = strlen(t1);
for (size_t i = 0; i < 16; i++) {
- const u8 *rv = rtruffleExec(mask1, mask2, (u8 *)t1, (u8 *)t1 + len - i);
- ASSERT_NE((const u8 *)t1 - 1, rv); // not found
+ const u8 *rv = rtruffleExec(mask1, mask2, reinterpret_cast<u8 *>(t1), reinterpret_cast<u8 *>(t1) + len - i);
+ ASSERT_NE(reinterpret_cast<const u8 *>(t1) - 1, rv); // not found
EXPECT_EQ('a', (char)*rv);
- ASSERT_EQ((const u8 *)t1 + 17, rv);
+ ASSERT_EQ(reinterpret_cast<const u8 *>(t1) + 17, rv);
}
}
CharReach chars;
chars.set('a');
- truffleBuildMasks(chars, (u8 *)&mask1, (u8 *)&mask2);
+ truffleBuildMasks(chars, reinterpret_cast<u8 *>(&mask1), reinterpret_cast<u8 *>(&mask2));
/* 0123456789012345678901234567890 */
char t1[] = "bbbbabbbbbbbbbbbbaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbb";
size_t len = strlen(t1);
for (size_t i = 0; i < 16; i++) {
- const u8 *rv = rtruffleExec(mask1, mask2, (u8 *)t1, (u8 *)t1 + len - i);
- ASSERT_NE((const u8 *)t1 - 1, rv); // not found
+ const u8 *rv = rtruffleExec(mask1, mask2, reinterpret_cast<u8 *>(t1), reinterpret_cast<u8 *>(t1) + len - i);
+ ASSERT_NE(reinterpret_cast<const u8 *>(t1) - 1, rv); // not found
EXPECT_EQ('a', (char)*rv);
- ASSERT_EQ((const u8 *)t1 + 32, rv);
+ ASSERT_EQ(reinterpret_cast<const u8 *>(t1) + 32, rv);
}
}
chars.set('a');
chars.set('B');
- truffleBuildMasks(chars, (u8 *)&mask1, (u8 *)&mask2);
+ truffleBuildMasks(chars, reinterpret_cast<u8 *>(&mask1), reinterpret_cast<u8 *>(&mask2));
/* 0123456789012345678901234567890 */
char t1[] = "bbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaBbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
size_t len = strlen(t1);
for (size_t i = 0; i < 16; i++) {
- const u8 *rv = rtruffleExec(mask1, mask2, (u8 *)t1, (u8 *)t1 + len - i);
- ASSERT_NE((const u8 *)t1 - 1, rv); // not found
+ const u8 *rv = rtruffleExec(mask1, mask2, reinterpret_cast<u8 *>(t1), reinterpret_cast<u8 *>(t1) + len - i);
+ ASSERT_NE(reinterpret_cast<const u8 *>(t1) - 1, rv); // not found
EXPECT_EQ('B', (char)*rv);
- ASSERT_EQ((const u8 *)t1 + 32, rv);
+ ASSERT_EQ(reinterpret_cast<const u8 *>(t1) + 32, rv);
}
// check that we match the 'a' bytes as well.
ASSERT_EQ('B', t1[32]);
t1[32] = 'b';
for (size_t i = 0; i < 16; i++) {
- const u8 *rv = rtruffleExec(mask1, mask2, (u8 *)t1, (u8 *)t1 + len - i);
- ASSERT_NE((const u8 *)t1 - 1, rv); // not found
+ const u8 *rv = rtruffleExec(mask1, mask2, reinterpret_cast<u8 *>(t1), reinterpret_cast<u8 *>(t1) + len - i);
+ ASSERT_NE(reinterpret_cast<const u8 *>(t1) - 1, rv); // not found
EXPECT_EQ('a', (char)*rv);
- ASSERT_EQ((const u8 *)t1 + 31, rv);
+ ASSERT_EQ(reinterpret_cast<const u8 *>(t1) + 31, rv);
}
}
chars.set('A');
chars.set('c');
- truffleBuildMasks(chars, (u8 *)&mask1, (u8 *)&mask2);
+ truffleBuildMasks(chars, reinterpret_cast<u8 *>(&mask1), reinterpret_cast<u8 *>(&mask2));
/* 0123456789012345678901234567890 */
char t1[] = "bbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaAbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
size_t len = strlen(t1);
for (size_t i = 0; i < 16; i++) {
- const u8 *rv = rtruffleExec(mask1, mask2, (u8 *)t1, (u8 *)t1 + len - i);
+ const u8 *rv = rtruffleExec(mask1, mask2, reinterpret_cast<u8 *>(t1), reinterpret_cast<u8 *>(t1) + len - i);
EXPECT_EQ('A', (char)*rv);
- ASSERT_EQ((const u8 *)t1 + 32, rv);
+ ASSERT_EQ(reinterpret_cast<const u8 *>(t1) + 32, rv);
- rv = rtruffleExec(mask1, mask2, (u8 *)t2, (u8 *)t2 + len - i);
+ rv = rtruffleExec(mask1, mask2, reinterpret_cast<u8 *>(t2), reinterpret_cast<u8 *>(t2) + len - i);
EXPECT_EQ('C', (char)*rv);
- ASSERT_EQ((const u8 *)t2 + 32, rv);
+ ASSERT_EQ(reinterpret_cast<const u8 *>(t2) + 32, rv);
- rv = rtruffleExec(mask1, mask2, (u8 *)t3, (u8 *)t3 + len - i);
+ rv = rtruffleExec(mask1, mask2, reinterpret_cast<u8 *>(t3), reinterpret_cast<u8 *>(t3) + len - i);
EXPECT_EQ('c', (char)*rv);
- ASSERT_EQ((const u8 *)t3 + 32, rv);
+ ASSERT_EQ(reinterpret_cast<const u8 *>(t3) + 32, rv);
- rv = rtruffleExec(mask1, mask2, (u8 *)t4, (u8 *)t4 + len - i);
+ rv = rtruffleExec(mask1, mask2, reinterpret_cast<u8 *>(t4), reinterpret_cast<u8 *>(t4) + len - i);
EXPECT_EQ('a', (char)*rv);
- ASSERT_EQ((const u8 *)t4 + 32, rv);
+ ASSERT_EQ(reinterpret_cast<const u8 *>(t4) + 32, rv);
}
}
CharReach chars;
chars.set('a');
- truffleBuildMasks(chars, (u8 *)&mask1, (u8 *)&mask2);
+ truffleBuildMasks(chars, reinterpret_cast<u8 *>(&mask1), reinterpret_cast<u8 *>(&mask2));
char t1[] = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
size_t len = strlen(t1);
for (size_t i = 0; i < len; i++) {
t1[i] = 'a';
- const u8 *rv = rtruffleExec(mask1, mask2, (u8 *)t1, (u8 *)t1 + len);
+ const u8 *rv = rtruffleExec(mask1, mask2, reinterpret_cast<u8 *>(t1), reinterpret_cast<u8 *>(t1) + len);
- ASSERT_EQ((const u8 *)t1 + i, rv);
+ ASSERT_EQ(reinterpret_cast<const u8 *>(t1) + i, rv);
}
}
TEST(Uniform, loadstore_u8) {
for (int i = 0; i < 8; i++) {
u8 in = 1 << i;
- const char *cin = (const char *)(&in);
+ const char *cin = reinterpret_cast<const char *>(&in);
u8 out = load_u8(cin);
EXPECT_EQ(in, out);
char ALIGN_DIRECTIVE stored[1];
TEST(Uniform, loadstore_u16) {
for (int i = 0; i < 16; i++) {
u16 in = 1 << i;
- const char *cin = (const char *)(&in);
+ const char *cin = reinterpret_cast<const char *>(&in);
u16 out = load_u16(cin);
EXPECT_EQ(in, out);
void *stored = aligned_zmalloc(2);
TEST(Uniform, loadstore_u32) {
for (int i = 0; i < 32; i++) {
u32 in = 1U << i;
- const char *cin = (const char *)(&in);
+ const char *cin = reinterpret_cast<const char *>(&in);
u32 out = load_u32(cin);
EXPECT_EQ(in, out);
void *stored = aligned_zmalloc(32/8);
TEST(Uniform, loadstore_u64a) {
for (int i = 0; i < 64; i++) {
u64a in = 1ULL << i;
- const char *cin = (const char *)(&in);
+ const char *cin = reinterpret_cast<const char *>(&in);
u64a out = load_u64a(cin);
EXPECT_EQ(in, out);
void *stored = aligned_zmalloc(64/8);
for (int i = 0; i < 128; i++) {
memset(&in, 0, sizeof(in));
in.words[i/32] = 1U << (i % 32);
- const char *cin = (const char *)(&in);
+ const char *cin = reinterpret_cast<const char *>(&in);
m128 out = load_m128(cin);
EXPECT_EQ(0, memcmp(&out, &in, sizeof(out)));
void *stored = aligned_zmalloc(128/8);
for (int i = 0; i < 256; i++) {
memset(&in, 0, sizeof(in));
in.words[i/32] = 1U << (i % 32);
- const char *cin = (const char *)(&in);
+ const char *cin = reinterpret_cast<const char *>(&in);
m256 out = load_m256(cin);
EXPECT_EQ(0, memcmp(&out, &in, sizeof(out)));
void *stored = aligned_zmalloc(256/8);
for (int i = 0; i < 512; i++) {
memset(&in, 0, sizeof(in));
in.words[i/32] = 1U << (i % 32);
- const char *cin = (const char *)(&in);
+ const char *cin = reinterpret_cast<const char *>(&in);
m512 out = load_m512(cin);
EXPECT_EQ(0, memcmp(&out, &in, sizeof(out)));
void *stored = aligned_zmalloc(512/8);
for (size_t i = 0; i < 16; i++) {
for (size_t j = 0; j < 16; j++) {
- const u8 *rv = vermicelliExec('a', 0, (u8 *)t1 + i,
- (u8 *)t1 + strlen(t1) - j);
+ const u8 *rv = vermicelliExec('a', 0, reinterpret_cast<u8 *>(t1) + i,
+ reinterpret_cast<u8 *>(t1) + strlen(t1) - j);
ASSERT_EQ(((size_t)t1 + strlen(t1) - j), (size_t)rv);
- rv = vermicelliExec('B', 0, (u8 *)t1 + i,
- (u8 *)t1 + strlen(t1) - j);
+ rv = vermicelliExec('B', 0, reinterpret_cast<u8 *>(t1) + i,
+ reinterpret_cast<u8 *>(t1) + strlen(t1) - j);
ASSERT_EQ(((size_t)t1 + strlen(t1) - j), (size_t)rv);
- rv = vermicelliExec('A', 1, (u8 *)t1 + i,
- (u8 *)t1 + strlen(t1) - j);
+ rv = vermicelliExec('A', 1, reinterpret_cast<u8 *>(t1) + i,
+ reinterpret_cast<u8 *>(t1) + strlen(t1) - j);
ASSERT_EQ(((size_t)t1 + strlen(t1) - j), (size_t)rv);
}
char t1[] = "bbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbb";
for (size_t i = 0; i < 16; i++) {
- const u8 *rv = vermicelliExec('a', 0, (u8 *)t1 + i,
- (u8 *)t1 + strlen(t1));
+ const u8 *rv = vermicelliExec('a', 0, reinterpret_cast<u8 *>(t1) + i,
+ reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)t1 + 17, (size_t)rv);
- rv = vermicelliExec('A', 1, (u8 *)t1 + i,
- (u8 *)t1 + strlen(t1));
+ rv = vermicelliExec('A', 1, reinterpret_cast<u8 *>(t1) + i,
+ reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)t1 + 17, (size_t)rv);
}
char t1[] = "bbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbabbbbbbbbbbbb";
for (size_t i = 0; i < 16; i++) {
- const u8 *rv = vermicelliExec('a', 0, (u8 *)t1 + i,
- (u8 *)t1 + strlen(t1));
+ const u8 *rv = vermicelliExec('a', 0, reinterpret_cast<u8 *>(t1) + i,
+ reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)t1 + 17, (size_t)rv);
- rv = vermicelliExec('A', 1, (u8 *)t1 + i,
- (u8 *)t1 + strlen(t1));
+ rv = vermicelliExec('A', 1, reinterpret_cast<u8 *>(t1) + i,
+ reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)t1 + 17, (size_t)rv);
}
char t1[] = "bbbbbbbbbbbbbbbbbAaaaaaaaaaaaaaaaaaaaaaabbbbbbbbabbbbbbbbbbbb";
for (size_t i = 0; i < 16; i++) {
- const u8 *rv = vermicelliExec('a', 0, (u8 *)t1 + i,
- (u8 *)t1 + strlen(t1));
+ const u8 *rv = vermicelliExec('a', 0, reinterpret_cast<u8 *>(t1) + i,
+ reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)t1 + 18, (size_t)rv);
- rv = vermicelliExec('A', 1, (u8 *)t1 + i,
- (u8 *)t1 + strlen(t1));
+ rv = vermicelliExec('A', 1, reinterpret_cast<u8 *>(t1) + i,
+ reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)t1 + 17, (size_t)rv);
}
for (size_t i = 0; i < 31; i++) {
t1[48 - i] = 'a';
- const u8 *rv = vermicelliExec('a', 0, (u8 *)t1, (u8 *)t1 + strlen(t1));
+ const u8 *rv = vermicelliExec('a', 0, reinterpret_cast<u8 *>(t1), reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)&t1[48 - i], (size_t)rv);
- rv = vermicelliExec('A', 1, (u8 *)t1, (u8 *)t1 + strlen(t1));
+ rv = vermicelliExec('A', 1, reinterpret_cast<u8 *>(t1), reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)&t1[48 - i], (size_t)rv);
}
for (size_t i = 0; i < 16; i++) {
for (size_t j = 0; j < 16; j++) {
- const u8 *rv = vermicelliDoubleExec('a', 'b', 0, (u8 *)t1 + i,
- (u8 *)t1 + strlen(t1) - j);
+ const u8 *rv = vermicelliDoubleExec('a', 'b', 0, reinterpret_cast<u8 *>(t1) + i,
+ reinterpret_cast<u8 *>(t1) + strlen(t1) - j);
ASSERT_EQ(((size_t)t1 + strlen(t1) - j), (size_t)rv);
- rv = vermicelliDoubleExec('B', 'b', 0, (u8 *)t1 + i,
- (u8 *)t1 + strlen(t1) - j);
+ rv = vermicelliDoubleExec('B', 'b', 0, reinterpret_cast<u8 *>(t1) + i,
+ reinterpret_cast<u8 *>(t1) + strlen(t1) - j);
ASSERT_EQ(((size_t)t1 + strlen(t1) - j), (size_t)rv);
- rv = vermicelliDoubleExec('A', 'B', 1, (u8 *)t1 + i,
- (u8 *)t1 + strlen(t1) - j);
+ rv = vermicelliDoubleExec('A', 'B', 1, reinterpret_cast<u8 *>(t1) + i,
+ reinterpret_cast<u8 *>(t1) + strlen(t1) - j);
ASSERT_EQ(((size_t)t1 + strlen(t1) - j), (size_t)rv);
/* partial match */
- rv = vermicelliDoubleExec('b', 'B', 0, (u8 *)t1 + i,
- (u8 *)t1 + strlen(t1) - j);
+ rv = vermicelliDoubleExec('b', 'B', 0, reinterpret_cast<u8 *>(t1) + i,
+ reinterpret_cast<u8 *>(t1) + strlen(t1) - j);
ASSERT_EQ(((size_t)t1 + strlen(t1) - j - 1), (size_t)rv);
/* partial match */
- rv = vermicelliDoubleExec('B', 'A', 1, (u8 *)t1 + i,
- (u8 *)t1 + strlen(t1) - j);
+ rv = vermicelliDoubleExec('B', 'A', 1, reinterpret_cast<u8 *>(t1) + i,
+ reinterpret_cast<u8 *>(t1) + strlen(t1) - j);
ASSERT_EQ(((size_t)t1 + strlen(t1) - j - 1), (size_t)rv);
}
char t1[] = "bbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbb";
for (size_t i = 0; i < 16; i++) {
- const u8 *rv = vermicelliDoubleExec('a', 'b', 0, (u8 *)t1 + i,
- (u8 *)t1 + strlen(t1));
+ const u8 *rv = vermicelliDoubleExec('a', 'b', 0, reinterpret_cast<u8 *>(t1) + i,
+ reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)t1 + 18, (size_t)rv);
- rv = vermicelliDoubleExec('A', 'B', 1, (u8 *)t1 + i,
- (u8 *)t1 + strlen(t1));
+ rv = vermicelliDoubleExec('A', 'B', 1, reinterpret_cast<u8 *>(t1) + i,
+ reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)t1 + 18, (size_t)rv);
- rv = vermicelliDoubleExec('b', 'a', 0, (u8 *)t1 + i,
- (u8 *)t1 + strlen(t1));
+ rv = vermicelliDoubleExec('b', 'a', 0, reinterpret_cast<u8 *>(t1) + i,
+ reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)t1 + 17, (size_t)rv);
- rv = vermicelliDoubleExec('B', 'A', 1, (u8 *)t1 + i,
- (u8 *)t1 + strlen(t1));
+ rv = vermicelliDoubleExec('B', 'A', 1, reinterpret_cast<u8 *>(t1) + i,
+ reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)t1 + 17, (size_t)rv);
}
char t1[] = "bbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbaaaaabbbbbbbb";
for (size_t i = 0; i < 16; i++) {
- const u8 *rv = vermicelliDoubleExec('a', 'a', 0, (u8 *)t1 + i,
- (u8 *)t1 + strlen(t1));
+ const u8 *rv = vermicelliDoubleExec('a', 'a', 0, reinterpret_cast<u8 *>(t1) + i,
+ reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)t1 + 17, (size_t)rv);
- rv = vermicelliDoubleExec('A', 'A', 1, (u8 *)t1 + i,
- (u8 *)t1 + strlen(t1));
+ rv = vermicelliDoubleExec('A', 'A', 1, reinterpret_cast<u8 *>(t1) + i,
+ reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)t1 + 17, (size_t)rv);
}
char t1[] = "bbbbbbbbbbbbbbbbbaAaaAAaaaaaaaaaaaaaaaaaabbbbbbbaaaaabbbbbbbb";
for (size_t i = 0; i < 16; i++) {
- const u8 *rv = vermicelliDoubleExec('A', 'a', 0, (u8 *)t1 + i,
- (u8 *)t1 + strlen(t1));
+ const u8 *rv = vermicelliDoubleExec('A', 'a', 0, reinterpret_cast<u8 *>(t1) + i,
+ reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)t1 + 18, (size_t)rv);
- rv = vermicelliDoubleExec('A', 'A', 1, (u8 *)t1 + i,
- (u8 *)t1 + strlen(t1));
+ rv = vermicelliDoubleExec('A', 'A', 1, reinterpret_cast<u8 *>(t1) + i,
+ reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)t1 + 17, (size_t)rv);
- rv = vermicelliDoubleExec('A', 'A', 0, (u8 *)t1 + i,
- (u8 *)t1 + strlen(t1));
+ rv = vermicelliDoubleExec('A', 'A', 0, reinterpret_cast<u8 *>(t1) + i,
+ reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)t1 + 21, (size_t)rv);
- rv = vermicelliDoubleExec('a', 'A', 0, (u8 *)t1 + i,
- (u8 *)t1 + strlen(t1));
+ rv = vermicelliDoubleExec('a', 'A', 0, reinterpret_cast<u8 *>(t1) + i,
+ reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)t1 + 17, (size_t)rv);
}
for (size_t i = 0; i < 31; i++) {
t1[48 - i] = 'a';
t1[48 - i + 1] = 'a';
- const u8 *rv = vermicelliDoubleExec('a', 'a', 0, (u8 *)t1,
- (u8 *)t1 + strlen(t1));
+ const u8 *rv = vermicelliDoubleExec('a', 'a', 0, reinterpret_cast<u8 *>(t1),
+ reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)&t1[48 - i], (size_t)rv);
- rv = vermicelliDoubleExec('A', 'A', 1, (u8 *)t1, (u8 *)t1 + strlen(t1));
+ rv = vermicelliDoubleExec('A', 'A', 1, reinterpret_cast<u8 *>(t1), reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)&t1[48 - i], (size_t)rv);
}
TEST(Vermicelli, noodEarlyExit) {
// searches that should fail
- static const u8 *lowerAlpha = (const u8*) "abcdefghijklmnopqrstuvwxyz";
+ static const u8 *lowerAlpha = reinterpret_cast<const u8 *>("abcdefghijklmnopqrstuvwxyz");
const u8 *la_end = lowerAlpha + 26;
EXPECT_EQ(la_end, vermicelliExec('0', 0, lowerAlpha, la_end));
EXPECT_EQ(la_end, vermicelliExec('A', 0, lowerAlpha, la_end));
SCOPED_TRACE(i);
for (size_t j = 0; j < 16; j++) {
SCOPED_TRACE(j);
- const u8 *rv = nvermicelliExec('b', 0, (u8 *)t1 + i,
- (u8 *)t1 + strlen(t1) - j);
+ const u8 *rv = nvermicelliExec('b', 0, reinterpret_cast<u8 *>(t1) + i,
+ reinterpret_cast<u8 *>(t1) + strlen(t1) - j);
ASSERT_EQ(((size_t)t1 + strlen(t1) - j), (size_t)rv);
- rv = nvermicelliExec('B', 1, (u8 *)t1 + i,
- (u8 *)t1 + strlen(t1) - j);
+ rv = nvermicelliExec('B', 1, reinterpret_cast<u8 *>(t1) + i,
+ reinterpret_cast<u8 *>(t1) + strlen(t1) - j);
ASSERT_EQ(((size_t)t1 + strlen(t1) - j), (size_t)rv);
}
for (size_t i = 0; i < 16; i++) {
SCOPED_TRACE(i);
- const u8 *rv = nvermicelliExec('b', 0, (u8 *)t1 + i,
- (u8 *)t1 + strlen(t1));
+ const u8 *rv = nvermicelliExec('b', 0, reinterpret_cast<u8 *>(t1) + i,
+ reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)t1 + 17, (size_t)rv);
- rv = nvermicelliExec('B', 1, (u8 *)t1 + i,
- (u8 *)t1 + strlen(t1));
+ rv = nvermicelliExec('B', 1, reinterpret_cast<u8 *>(t1) + i,
+ reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)t1 + 17, (size_t)rv);
}
for (size_t i = 0; i < 16; i++) {
SCOPED_TRACE(i);
- const u8 *rv = nvermicelliExec('b', 0, (u8 *)t1 + i,
- (u8 *)t1 + strlen(t1));
+ const u8 *rv = nvermicelliExec('b', 0, reinterpret_cast<u8 *>(t1) + i,
+ reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)t1 + 17, (size_t)rv);
- rv = nvermicelliExec('B', 1, (u8 *)t1 + i,
- (u8 *)t1 + strlen(t1));
+ rv = nvermicelliExec('B', 1, reinterpret_cast<u8 *>(t1) + i,
+ reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)t1 + 17, (size_t)rv);
}
for (size_t i = 0; i < 16; i++) {
SCOPED_TRACE(i);
- const u8 *rv = nvermicelliExec('b', 0, (u8 *)t1 + i,
- (u8 *)t1 + strlen(t1));
+ const u8 *rv = nvermicelliExec('b', 0, reinterpret_cast<u8 *>(t1) + i,
+ reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)t1 + 17, (size_t)rv);
- rv = nvermicelliExec('B', 1, (u8 *)t1 + i,
- (u8 *)t1 + strlen(t1));
+ rv = nvermicelliExec('B', 1, reinterpret_cast<u8 *>(t1) + i,
+ reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)t1 + 18, (size_t)rv);
}
for (size_t i = 0; i < 31; i++) {
SCOPED_TRACE(i);
t1[48 - i] = 'a';
- const u8 *rv = nvermicelliExec('b', 0, (u8 *)t1, (u8 *)t1 + strlen(t1));
+ const u8 *rv = nvermicelliExec('b', 0, reinterpret_cast<u8 *>(t1), reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)&t1[48 - i], (size_t)rv);
- rv = nvermicelliExec('B', 1, (u8 *)t1, (u8 *)t1 + strlen(t1));
+ rv = nvermicelliExec('B', 1, reinterpret_cast<u8 *>(t1), reinterpret_cast<u8 *>(t1) + strlen(t1));
ASSERT_EQ((size_t)&t1[48 - i], (size_t)rv);
}
TEST(DoubleVermicelliMasked, ExecNoMatch1) {
std::string t1("bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
- const u8 *t1_raw = (const u8 *)t1.c_str();
+ const u8 *t1_raw = reinterpret_cast<const u8 *>(t1.c_str());
for (size_t i = 0; i < 16; i++) {
for (size_t j = 0; j < 16; j++) {
TEST(DoubleVermicelliMasked, Exec1) {
std::string t1("bbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbb");
- const u8 *t1_raw = (const u8 *)t1.c_str();
+ const u8 *t1_raw = reinterpret_cast<const u8 *>(t1.c_str());
for (size_t i = 0; i < 16; i++) {
const u8 *rv = vermicelliDoubleMaskedExec('a', 'b', 0xff, 0xff,
TEST(DoubleVermicelliMasked, Exec2) {
std::string t1("bbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbaaaaabbbbbbbb");
- const u8 *t1_raw = (const u8 *)t1.c_str();
+ const u8 *t1_raw = reinterpret_cast<const u8 *>(t1.c_str());
for (size_t i = 0; i < 16; i++) {
const u8 *rv = vermicelliDoubleMaskedExec('a', 'a', 0xff, 0xff,
TEST(DoubleVermicelliMasked, Exec3) {
/* 012345678901234567890123 */
std::string t1("bbbbbbbbbbbbbbbbbaAaaAAaaaaaaaaaaaaaaaaaabbbbbbbaaaaabbbbbbbb");
- const u8 *t1_raw = (const u8 *)t1.c_str();
+ const u8 *t1_raw = reinterpret_cast<const u8 *>(t1.c_str());
for (size_t i = 0; i < 16; i++) {
const u8 *rv = vermicelliDoubleMaskedExec('A', 'a', 0xff, 0xff,
TEST(DoubleVermicelliMasked, Exec4) {
std::string t1("bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
- const u8 *t1_raw = (const u8 *)t1.c_str();
+ const u8 *t1_raw = reinterpret_cast<const u8 *>(t1.c_str());
for (size_t i = 0; i < 31; i++) {
t1[48 - i] = 'a';
TEST(Vermicelli16, ExecNoMatch1) {
char t1[] = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
- const u8 *buf = (const u8 *)t1;
+ const u8 *buf = reinterpret_cast<const u8 *>(t1);
CharReach chars;
chars.set('a');
TEST(Vermicelli16, Exec1) {
char t1[] = "bbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbb";
- const u8 *buf = (const u8 *)t1;
+ const u8 *buf = reinterpret_cast<const u8 *>(t1);
CharReach chars;
chars.set('a');
TEST(Vermicelli16, Exec2) {
char t1[] = "bbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbabbbbbbbbbbbb";
- const u8 *buf = (const u8 *)t1;
+ const u8 *buf = reinterpret_cast<const u8 *>(t1);
CharReach chars;
chars.set('a');
TEST(Vermicelli16, Exec3) {
char t1[] = "bbbbbbbbbbbbbbbbbAaaaaaaaaaaaaaaaaaaaaaabbbbbbbbabbbbbbbbbbbb";
- const u8 *buf = (const u8 *)t1;
+ const u8 *buf = reinterpret_cast<const u8 *>(t1);
CharReach chars;
chars.set('a');
TEST(Vermicelli16, Exec4) {
char t1[] = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
- const u8 *buf = (const u8 *)t1;
+ const u8 *buf = reinterpret_cast<const u8 *>(t1);
CharReach chars;
chars.set('a');
TEST(Vermicelli16, Exec5) {
char t1[] = "qqqqqqqqqqqqqqqqqabcdefghijklmnopqqqqqqqqqqqqqqqqqqqqq";
- const u8 *buf = (const u8 *)t1;
+ const u8 *buf = reinterpret_cast<const u8 *>(t1);
CharReach chars;
m128 matches[16];
TEST(NVermicelli16, ExecNoMatch1) {
char t1[] = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
- const u8 *buf = (const u8 *)t1;
+ const u8 *buf = reinterpret_cast<const u8 *>(t1);
CharReach chars;
chars.set('b');
TEST(NVermicelli16, Exec1) {
char t1[] = "bbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbb";
- const u8 *buf = (const u8 *)t1;
+ const u8 *buf = reinterpret_cast<const u8 *>(t1);
CharReach chars;
chars.set('b');
TEST(NVermicelli16, Exec2) {
char t1[] = "bbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbabbbbbbbbbbbb";
- const u8 *buf = (const u8 *)t1;
+ const u8 *buf = reinterpret_cast<const u8 *>(t1);
CharReach chars;
chars.set('b');
TEST(NVermicelli16, Exec3) {
char t1[] = "bbbbbbbbbbbbbbbbbAaaaaaaaaaaaaaaaaaaaaaabbbbbbbbabbbbbbbbbbbb";
- const u8 *buf = (const u8 *)t1;
+ const u8 *buf = reinterpret_cast<const u8 *>(t1);
CharReach chars;
chars.set('b');
TEST(NVermicelli16, Exec4) {
char t1[] = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
- const u8 *buf = (const u8 *)t1;
+ const u8 *buf = reinterpret_cast<const u8 *>(t1);
CharReach chars;
chars.set('b');
TEST(NVermicelli16, Exec5) {
char t1[] = "aaaaaaaaaaaaaaaaaabcdefghijklmnopqaaaaaaaaaaaaaaaaaaaaa";
- const u8 *buf = (const u8 *)t1;
+ const u8 *buf = reinterpret_cast<const u8 *>(t1);
CharReach chars;
m128 matches[16];
TEST(DoubleVermicelli16, ExecNoMatch1) {
std::string t1("bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
- const u8 *t1_raw = (const u8 *)t1.c_str();
+ const u8 *t1_raw = reinterpret_cast<const u8 *>(t1.c_str());
m128 matches;
u64a firsts;
TEST(DoubleVermicelli16, ExecNoMatch2) {
std::string t1("bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
- const u8 *t1_raw = (const u8 *)t1.c_str();
+ const u8 *t1_raw = reinterpret_cast<const u8 *>(t1.c_str());
m128 matches;
u64a firsts;
TEST(DoubleVermicelli16, ExecNoMatch3) {
std::string t1("bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
- const u8 *t1_raw = (const u8 *)t1.c_str();
+ const u8 *t1_raw = reinterpret_cast<const u8 *>(t1.c_str());
m128 matches;
u64a firsts;
TEST(DoubleVermicelli16, Exec1) {
std::string t1("bbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbb");
- const u8 *t1_raw = (const u8 *)t1.c_str();
+ const u8 *t1_raw = reinterpret_cast<const u8 *>(t1.c_str());
m128 matches;
u64a firsts;
TEST(DoubleVermicelli16, Exec2) {
std::string t1("bbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbaaaaabbbbbbbb");
- const u8 *t1_raw = (const u8 *)t1.c_str();
+ const u8 *t1_raw = reinterpret_cast<const u8 *>(t1.c_str());
m128 matches;
u64a firsts;
TEST(DoubleVermicelliMasked16, ExecNoMatch1) {
std::string t1("bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
- const u8 *t1_raw = (const u8 *)t1.c_str();
+ const u8 *t1_raw = reinterpret_cast<const u8 *>(t1.c_str());
m128 matches1;
bool ret = vermicelliDoubleMasked16Build('a', 'b', 0xff, 0xff, (u8 *)&matches1);
TEST(DoubleVermicelliMasked16, Exec1) {
std::string t1("bbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbb");
- const u8 *t1_raw = (const u8 *)t1.c_str();
+ const u8 *t1_raw = reinterpret_cast<const u8 *>(t1.c_str());
m128 matches1;
bool ret = vermicelliDoubleMasked16Build('a', 'b', 0xff, 0xff, (u8 *)&matches1);
TEST(DoubleVermicelliMasked16, Exec2) {
std::string t1("bbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbaaaaabbbbbbbb");
- const u8 *t1_raw = (const u8 *)t1.c_str();
+ const u8 *t1_raw = reinterpret_cast<const u8 *>(t1.c_str());
m128 matches1;
bool ret = vermicelliDoubleMasked16Build('a', 'a', 0xff, 0xff, (u8 *)&matches1);
TEST(DoubleVermicelliMasked16, Exec3) {
/* 012345678901234567890123 */
std::string t1("bbbbbbbbbbbbbbbbbaAaaAAaaaaaaaaaaaaaaaaaabbbbbbbaaaaabbbbbbbb");
- const u8 *t1_raw = (const u8 *)t1.c_str();
+ const u8 *t1_raw = reinterpret_cast<const u8 *>(t1.c_str());
m128 matches1;
bool ret = vermicelliDoubleMasked16Build('A', 'a', 0xff, 0xff, (u8 *)&matches1);
TEST(DoubleVermicelliMasked16, Exec4) {
std::string t1("bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
- const u8 *t1_raw = (const u8 *)t1.c_str();
+ const u8 *t1_raw = reinterpret_cast<const u8 *>(t1.c_str());
m128 matches1;
bool ret = vermicelliDoubleMasked16Build('a', 'a', 0xff, 0xff, (u8 *)&matches1);
TEST(DoubleVermicelliMasked16, Exec5) {
std::string t1("bbbbbbbbbbbbbbbbbaCaGaOCaChBfcNgBFGiLbbbbbbbbbbbbbbbbbbbbbbbb");
- const u8 *t1_raw = (const u8 *)t1.c_str();
+ const u8 *t1_raw = reinterpret_cast<const u8 *>(t1.c_str());
m128 matches1;
bool ret = vermicelliDoubleMasked16Build('a', 'B', 0xff, 0xde, (u8 *)&matches1);