mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-11-17 17:55:28 +03:00
Introduce REPEAT_ALWAYS model for {0,} castle repeats
As Castle guards the repeats, no more state is needed for these repeats
This commit is contained in:
@@ -922,6 +922,11 @@ void repeatPackOffset(char *dest, const struct RepeatInfo *info,
|
||||
const union RepeatControl *ctrl, u64a offset) {
|
||||
const struct RepeatOffsetControl *xs = &ctrl->offset;
|
||||
DEBUG_PRINTF("packing offset %llu [h %u]\n", xs->offset, info->horizon);
|
||||
if (!info->packedCtrlSize) {
|
||||
assert(info->type == REPEAT_ALWAYS);
|
||||
DEBUG_PRINTF("externally guarded .*\n");
|
||||
return;
|
||||
}
|
||||
storePackedRelative(dest, xs->offset, offset, info->horizon,
|
||||
info->packedCtrlSize);
|
||||
}
|
||||
@@ -1040,6 +1045,9 @@ void repeatPack(char *dest, const struct RepeatInfo *info,
|
||||
case REPEAT_TRAILER:
|
||||
repeatPackTrailer(dest, info, ctrl, offset);
|
||||
break;
|
||||
case REPEAT_ALWAYS:
|
||||
/* nothing to do - no state */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1072,7 +1080,13 @@ static
|
||||
void repeatUnpackOffset(const char *src, const struct RepeatInfo *info,
|
||||
u64a offset, union RepeatControl *ctrl) {
|
||||
struct RepeatOffsetControl *xs = &ctrl->offset;
|
||||
xs->offset = loadPackedRelative(src, offset, info->packedCtrlSize);
|
||||
if (!info->packedCtrlSize) {
|
||||
assert(info->type == REPEAT_ALWAYS);
|
||||
DEBUG_PRINTF("externally guarded .*\n");
|
||||
xs->offset = 0;
|
||||
} else {
|
||||
xs->offset = loadPackedRelative(src, offset, info->packedCtrlSize);
|
||||
}
|
||||
DEBUG_PRINTF("unpacking offset %llu [h%u]\n", xs->offset,
|
||||
info->horizon);
|
||||
}
|
||||
@@ -1149,6 +1163,9 @@ void repeatUnpack(const char *src, const struct RepeatInfo *info, u64a offset,
|
||||
case REPEAT_TRAILER:
|
||||
repeatUnpackTrailer(src, info, offset, ctrl);
|
||||
break;
|
||||
case REPEAT_ALWAYS:
|
||||
/* nothing to do - no state */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user