c++ - Comparing 8 - bit Unsigned Integer to HEX Failing -
i have c++ vector full of uint8_t values tcp data segment. looking 1 of 2 values should @ first index of vector.
i have following if statement express logic.
if ( ui8bufferin.at(0) != 0xe4 || ui8bufferin.at(0) != 0xe2){ printf("\nwe have problem, no parsing done, package type = %u\n", ui8bufferin.at(0)); proceed = false; }
the above if statement executing when shouldn't. following printout:
we have problem, no parsing done, package type = 226
so don't have math, 226
integer 0xe2
in hex.
i've been @ while, may simple, great!
i think might want logic be:
if ( ui8bufferin.at(0) != 0xe4 && ui8bufferin.at(0) != 0xe2){
as right you're saying "if either case of: (it's not 0xe4
) or case of: (it's not 0xe2
), have problem" - which, if understand correctly, not want say. statement, getting 0xe2
, because you're not getting 0xe4
(ui8bufferin.at(0) != 0xe4
), statement executes.
Comments
Post a Comment