LongVar1 = 1 << s;
That line shifts a 1 of type "int" left by "s" bits. "int" is only 16 bits wide on many of the Arduinos. Change "1" to "1UL" to make it an unsigned long to match "LongVar1".
LongVar1 = 1 << s;
That line shifts a 1 of type "int" left by "s" bits. "int" is only 16 bits wide on many of the Arduinos. Change "1" to "1UL" to make it an unsigned long to match "LongVar1".