I try to implement a bitwise filter using MYSQL (with udf if needed)
The filter is something like a AND but I want to use the mask to build a new bit string... Let me explain you with a sample :
Suppose I have a table with blob storing 8 bit streams:
- data1: 10110110
- data2: 01100010
- data3: 00010011
Then I have a mask to apply to get the bits from data when mask value is 1
- MASK: 00101011
And so get the following expected results:
- data1: 1010
- data2: 1010
- data3: 0011
Is there a way to optimize the filtering, without looping on each bit of "mask" to get the corresponding value in "data" row...
CLARIFICATION
I've just taken 8 bits for the post, but it's more like 256 bytes
for Joe : To clarify the exemple, the mask 00101011 is interpreted as : get the bit value from data field at position 3,5,7,8, if you read the mask from left to right, enumerated from bit 1 to bit 8... Hope this clarification is "clear"...