diff options
author | Ivan Blinkov <ivan@blinkov.ru> | 2022-02-10 16:47:10 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:10 +0300 |
commit | 1aeb9a455974457866f78722ad98114bafc84e8a (patch) | |
tree | e4340eaf1668684d83a0a58c36947c5def5350ad /contrib/libs/hyperscan/src/nfa/repeat.c | |
parent | bd5ef432f5cfb1e18851381329d94665a4c22470 (diff) | |
download | ydb-1aeb9a455974457866f78722ad98114bafc84e8a.tar.gz |
Restoring authorship annotation for Ivan Blinkov <ivan@blinkov.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/hyperscan/src/nfa/repeat.c')
-rw-r--r-- | contrib/libs/hyperscan/src/nfa/repeat.c | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/contrib/libs/hyperscan/src/nfa/repeat.c b/contrib/libs/hyperscan/src/nfa/repeat.c index 5b2e4df4ed..21cddd6f8a 100644 --- a/contrib/libs/hyperscan/src/nfa/repeat.c +++ b/contrib/libs/hyperscan/src/nfa/repeat.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Intel Corporation + * Copyright (c) 2015-2017, Intel Corporation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -177,10 +177,10 @@ u64a repeatLastTopRange(const union RepeatControl *ctrl, const void *state) { u64a repeatLastTopBitmap(const union RepeatControl *ctrl) { const struct RepeatBitmapControl *xs = &ctrl->bitmap; - if (!xs->bitmap) { - /* last top was too long ago */ - return 0; - } + if (!xs->bitmap) { + /* last top was too long ago */ + return 0; + } return xs->offset + 63 - clz64(xs->bitmap); } @@ -886,25 +886,25 @@ enum RepeatMatch repeatHasMatchTrailer(const struct RepeatInfo *info, return REPEAT_NOMATCH; } -/** \brief True if the given value can be packed into len bytes. */ -static really_inline -int fits_in_len_bytes(u64a val, u32 len) { - if (len >= 8) { - return 1; - } - return val <= (1ULL << (len * 8)); -} - +/** \brief True if the given value can be packed into len bytes. */ static really_inline +int fits_in_len_bytes(u64a val, u32 len) { + if (len >= 8) { + return 1; + } + return val <= (1ULL << (len * 8)); +} + +static really_inline void storePackedRelative(char *dest, u64a val, u64a offset, u64a max, u32 len) { assert(val <= offset); - assert(fits_in_len_bytes(max, len)); + assert(fits_in_len_bytes(max, len)); u64a delta = offset - val; if (delta >= max) { delta = max; } DEBUG_PRINTF("delta %llu\n", delta); - assert(fits_in_len_bytes(delta, len)); + assert(fits_in_len_bytes(delta, len)); partial_store_u64a(dest, delta, len); } @@ -936,11 +936,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; - } + if (!info->packedCtrlSize) { + assert(info->type == REPEAT_ALWAYS); + DEBUG_PRINTF("externally guarded .*\n"); + return; + } storePackedRelative(dest, xs->offset, offset, info->horizon, info->packedCtrlSize); } @@ -981,7 +981,7 @@ void repeatPackBitmap(char *dest, const struct RepeatInfo *info, DEBUG_PRINTF("packing %llu into %u bytes\n", bitmap, info->packedCtrlSize); // Write out packed bitmap. - assert(fits_in_len_bytes(bitmap, info->packedCtrlSize)); + assert(fits_in_len_bytes(bitmap, info->packedCtrlSize)); partial_store_u64a(dest, bitmap, info->packedCtrlSize); } @@ -1060,9 +1060,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; + case REPEAT_ALWAYS: + /* nothing to do - no state */ + break; } } @@ -1095,13 +1095,13 @@ static void repeatUnpackOffset(const char *src, const struct RepeatInfo *info, u64a offset, union RepeatControl *ctrl) { struct RepeatOffsetControl *xs = &ctrl->offset; - if (!info->packedCtrlSize) { - assert(info->type == REPEAT_ALWAYS); - DEBUG_PRINTF("externally guarded .*\n"); - xs->offset = 0; - } else { - 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); } @@ -1178,9 +1178,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; + case REPEAT_ALWAYS: + /* nothing to do - no state */ + break; } } @@ -1455,7 +1455,7 @@ void repeatStoreSparseOptimalP(const struct RepeatInfo *info, DEBUG_PRINTF("xs->first:%u xs->last:%u patch:%u\n", xs->first, xs->last, patch); DEBUG_PRINTF("value:%llu\n", val); - assert(fits_in_len_bytes(val, encoding_size)); + assert(fits_in_len_bytes(val, encoding_size)); partial_store_u64a(ring + encoding_size * idx, val, encoding_size); mmbit_set(active, patch_count, idx); } |