Check if a variable is between a certain value

Hi

I'm trying to implement some hysterisis on a program. What would be the fastest way to achieve this?

Say for example, my hysterisis on data received by thew ADC is 100.

What I want is to check if the data is larger OR smaller than the last received value by 100.

For example:

At startup:
Previous ADC_Reading = 877
my var = ADC_reading.

Main loop

if (ADC_reading => my var+100 =<100)
{
myvar = ADC_reading
}
else
{
do nothing
}

I'm a bit confused on how to achieve this for both positive and negative values. Any sugestions?

if ( ADC_reading >= my var + 100 || ADC_reading <= my var - 100 )

Is this what you mean?

If ADC_reading is a local variable, I think (not sure) that this could be faster:

if ( ADC_reading - 100 >= my var || ADC_reading + 100 <= my var )
if ( abs (ADC_reading - my var ) > 100) ...