Why is sextend a part of the word interface?
@samuelgruetter
As sign extension goes from one word size to another word size, shouldn't it be a derived function from a word of one size to a word of another size?
There are two sextend: The one you have in mind (which goes from one word size to another word size) and the one currently in here (which ignores the upper bits of the input word). Both have valid use cases.
I understand, but why is it in the word interface?
Would you prefer to implement sextend in terms of "more fundamental" operations like testbit, bitwise and, shift, etc? This should work, the question is just whether some day we care about performance of evaluating word expressions and find a super efficient word representation with a native sextend, then it would be better to have it in the interface. Not sure though how relevant that scenario is but that's what I had in mind when I was working on the interface.
I think my main concern is that sextend does not seem like a natural word operation to me, in that its input is not clearly of the same type of as the output. Thus I would define it as an operation that does work on words, but is not a required part of the word interface.