[SR-Users] How to check a bit (1/0) of a pseudo-variable?

Iñaki Baz Castillo ibc at aliax.net
Thu Jun 16 13:08:37 CEST 2011


Hi, summarizing I have two pseudo-variables:

  $var(allowed_zones) = 5;
  $var(id_zone) = 2;

The binary representation of 5 (3+2), assuming 8 bits lenght, is:

  00000101

so bit 0 = 1,
     bit 1 = 0,
     bit 2 = 1
     ...

Now I just need to know if bit number 2 ($var(id_zone)) of
$var(allowed_zones) is 0 or 1.

Is there any function like isflagset() but for pseudo-variables?

Thanks a lot.



-- 
Iñaki Baz Castillo
<ibc at aliax.net>



More information about the sr-users mailing list