I don't see your logic. Bit patterns are independent of their interpretation as integers, +ve or negative, or anything else for that matter - they're just patterns.
Quoted from IanLambley
the ibits function probably will only work up to 31, because for a 4byte integer, whilst there are 32 bits, these are numbered from 0 to 31 and 32 does not exist.
It's this kind of thing - functions with arguments one of which is base 0 indexed and another of which is base 1 indexed - that really highlights the downside of ordinal/cardinal schizophrenia 😃
The bits are indexed from 0 to 31, yes, and there are 32 of them, yes. In index terms, the 32nd bit does not exist, yes, in headcount terms the 32nd bit does exist, because there are 32 of them. So asking for any headcount of bits from 0 to 32, inclusive, starting from bit with index 0, is a perfectly reasonable request - unless the starting bit is an exclusive marker i.e. not returned as part of the payload. And this is not the case.
If I have 32-bit integers T and S for target and source, then:
T = IBITS (S, 0, 0) should leave T unchanged, or fill it with zeroes (not sure which)
T = IBITS (S, 0, 1) to T = IBITS (S, 0, 32) should should fill T with from 1 to 32 bits of S, padded with unset bits
T = IBITS (S, 0, 33) is the first one that should fail, possibly in an interesting way since the documentation says only that LEN must be non-negative, not that it must satisfy 0 ⇐ LEN ⇐ BIT_SIZE (S)
Exactly the same logic applies for any starting POS other than 0 e.g.:
T = IBITS (S, 10, 0) should leave T unchanged, or fill it with zeroes (not sure which)
T = IBITS (S, 10, 1) to T = IBITS (S, 10, 22) should should fill T with from 1 to 22 bits of S, padded with unset bits
T = IBITS (S, 10, 23) is the first one that should fail since there are only 22 bits available starting from number 10 inclusive (bits 0-9 are 10 bits altogether, so there are 22 left over).
For POS = 31, the only calls that make sense are:
T = IBITS (S, 31, 0)
T = IBITS (S, 31, 1)