What is the fastest way to bytewise examine the contetnt of quadword I have the following byte: 0x0A and I need to test if a quadword contains it or no using standard bitwise operarion (or, nor, xor). For instance:

0x1689FFBB768922AC ---> false
0x106489320A792399 ---> true

Unfortunately I cannot use intel SSE2 extension because this will make the code heavily depndent on the platform.

Can we find some bitmask to bitwise or with? Or maybe something else...?
Yes, it can be done.  Here is one reasonable approach.  First XOR the value with 0x0A0A..0A:

t = x ^ 0x0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A;


So now the problem becomes testing whether y contains a zero byte.  First we'll replace every byte with a single bit that is 1 if the byte is non-zero, or 0 if the byte is zero:

u = t | (t&gt;&gt;4);
u = u | (u&gt;&gt;2);
u = u | (u&gt;&gt;1);


(Here we only care about the least significant bit of each byte; the remaining bit positions hold garbage that we don't care about.)  Now we'll flip each of those bits:

v = ~u;


At this point the LSB of each byte is 1 if the original value contained a 0x0A there, or 0 otherwise.  So, we'll test whether any of these bits are 1:

w = v | (v&gt;&gt;64);
w = w | (w&gt;&gt;32);
w = w | (w&gt;&gt;16);
w = w | (w&gt;&gt;8);
y = w &amp; 1;


At this point, y is the result you are looking for: it will be 1 if the original value had a 0x0A byte anywhere, or 0 otherwise.