How to set a bitmask in C of all 1s from a given lowbit to highbit using only bitwise operators
The allowed operators are ! ~ & ^ | + << >>. The only data type I'm allowed to use are ints and the only constants I can declare have to be between 0 and 255 inclusive. The function takes in an int lowbit and an int highbit and returns a bitmask with 1s from lowbit to highbit inclusive.

    e.g. bitmask(3,5) = 0x38

I have a pretty good idea how to do it using shift but the problem I'm having is that when lowbit > highbit the function returns a bitmask of all 0's. I have no idea how to do that.
How to set a bitmask in C of all 1s from a given lowbit to highbit using only bitwise operators
===

The allowed operators are ! ~ & ^ | + << >>. The only data type I'm allowed to use are ints and the only constants I can declare have to be between 0 and 255 inclusive. The function takes in an int lowbit and an int highbit and returns a bitmask with 1s from lowbit to highbit inclusive.

    e.g. bitmask(3,5) = 0x38

I have a pretty good idea how to do it using shift but the problem I'm having is that when lowbit > highbit the function returns a bitmask of all 0's. I have no idea how to do that.