> Ada's approach to integer overflows is substantially similar to AIR

Isn't Ada's response to overflow implementation-defined?


On Mon, Jun 23, 2014 at 11:37 AM, John Regehr <reg...@cs.utah.edu> wrote:

>  I would think that something simple like
>>
>>    let mut sum = 0;
>>    for x in some_int_array.iter() {
>>        sum += x;
>>    }
>>
>> would be very hard to vectorise with unwinding integer operations.
>>
>
> It sounds like there are two problems.  First, you need to give up on
> precise exceptions.  So the code becomes something line:
>
>
> let mut sum = 0;
> overflow = false
> for x in some_int_array.iter() {
>   (sum,o) = x+sum
>   overflow |= o
> }
> if (overflow) deal with it
>
> The other problem is that as far as I know AVX doesn't store the overflow
> bits for integer vector operations and recovering these bits another way
> isn't necessarily cheap.
>
> In an earlier mail Patrick said that AIR integers are research and using
> research results is risky.  This is true but keep in mind that Ada's
> approach to integer overflows is substantially similar to AIR, and Ada is
> not a research language.
>
> John
>
> _______________________________________________
> Rust-dev mailing list
> Rust-dev@mozilla.org
> https://mail.mozilla.org/listinfo/rust-dev
>
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to