Fastest way to scan for bit pattern in a stream of bits

后端 未结 13 1811
悲哀的现实
悲哀的现实 2020-12-07 13:38

I need to scan for a 16 bit word in a bit stream. It is not guaranteed to be aligned on byte or word boundaries.

What is the fastest way of achieving this

13条回答
  •  我在风中等你
    2020-12-07 14:24

    Maybe you should stream in your bit stream in a vector (vec_str), stream in your pattern in another vector (vec_pattern) and then do something like the algorithm below

    i=0
    while i

    (hope the algorithm is correct)

提交回复
热议问题