'off by one' is vague - you mean +1 (matching n, n+1) (I interpret 'off by one' as +/- 1)
lets try some example value = 2 and value = 3
BTW -you should express your code as supplying "The Value" input and show what you do to get the 'oddnbr' used in the test, as THAT IS should be part of your algorthm's generalized method...)
candidates ORed with 0b00000001 (1) supposedly being equal to some calculated 'oddnbr' (however THAT is calculated)
case value = 2 oddnbr = 3 ...
2 0b00000010 | 0b00000001 == 0b00000011 compared to 0b00000011 works
3 0b00000011 | 0b00000001 == 0b00000011 compared to 0b00000011 works
OK
case value = 3 oddnbr = 3 ...?? or 4 or ???? how to get this ??????????
3 0b00000011 | 0b00000001 == 0b00000011 compared to 0b00000011 works
4 0b00000100 | 0b00000001 == 0b00000101 compared to 0b00000011 FAILS is equal to 5 (YET is 'off by one' from 3)
so this system doesnt work at all because there are cases (illustrated) where there isnt a single 'oddnbr' for it to work with certain values of 'value'.
(note -- this is ignoring further complications if negative numbers are being involved )
Isnt it really quite simpler (and alot clearer) just to do a double clause test
(second claus is usually shortcircuited (skipped when first clause TRUE) by even mildly apt compilers)
if ((candidate == value) || (candidate == value+1)) { /* it is good so do something*/ }
--------------------------------------------[size="1"]Ratings are Opinion, not Fact