On 29/11/2018 07:19, Robert Ramey wrote:
On 11/28/18 8:34 AM, Daniela Engert wrote:
Did you actually bother to think about my proposal? I don't want to take away 'int' (as it is specified in the language). I want an *additional* signed integral type with a sane mathematical definition: an abelian group with modulus. And it should offer a widening multiplication N * N -> 2N in addition to the regular one N * N -> N. The compiler should know about this type and lower it's operations to the corresponding hardware instruction (in most cases a single one).
Would this be of value only in the (special) case where N is a power of 2? Seems like a very special case to me. For such a special case, I'd expect to be able to insert some inline assembler to do the job as opposed to altering the core language.
Here N is referring to the bit size of the type, which is "always" (barring weird architectures) a power of two. It is possible to define such a type as a library, using inline assembly where possible and with a fallback to a less efficient portable implementation otherwise. Direct compiler support is not required, though might be nice.