[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bitshift of int8, int16, etc?
From: |
David Bateman |
Subject: |
Re: bitshift of int8, int16, etc? |
Date: |
Mon, 25 Jun 2007 16:07:24 +0200 |
User-agent: |
Thunderbird 1.5.0.7 (X11/20060921) |
I believe the attached patch is what is needed to make the bitshift of
signed integer types the same as bitshifts of floating point numbers
D.
--
David Bateman address@hidden
Motorola Labs - Paris +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin +33 6 72 01 06 33 (Mob)
91193 Gif-Sur-Yvette FRANCE +33 1 69 35 77 01 (Fax)
The information contained in this communication has been classified as:
[x] General Business Information
[ ] Motorola Internal Use Only
[ ] Motorola Confidential Proprietary
*** liboctave/oct-inttypes.h.~1.29.~ 2007-04-05 18:14:08.000000000 +0200
--- liboctave/oct-inttypes.h 2007-06-25 14:35:09.469552617 +0200
***************
*** 295,308 ****
template <class T2>
octave_int<T>& operator <<= (const T2& x)
{
! ival = ((ival << x) > std::numeric_limits<T>::max ()) ? 0 : (ival << x);
return *this;
}
template <class T2>
octave_int<T>& operator >>= (const T2& x)
{
! ival >>= x;
return *this;
}
--- 295,311 ----
template <class T2>
octave_int<T>& operator <<= (const T2& x)
{
! ival = ival << x;
return *this;
}
template <class T2>
octave_int<T>& operator >>= (const T2& x)
{
! if (ival < 0)
! ival = - (((-ival) >> x) & std::numeric_limits<T>::max());
! else
! ival = ival >> x;
return *this;
}
- bitshift of int8, int16, etc?, David Bateman, 2007/06/24
- Re: bitshift of int8, int16, etc?, Daniel J Sebald, 2007/06/24
- Re: bitshift of int8, int16, etc?, Daniel J Sebald, 2007/06/24
- Re: bitshift of int8, int16, etc?, David Bateman, 2007/06/25
- Re: bitshift of int8, int16, etc?, Daniel J Sebald, 2007/06/25
- Re: bitshift of int8, int16, etc?, David Bateman, 2007/06/25
- Re: bitshift of int8, int16, etc?, Daniel J Sebald, 2007/06/25
- Re: bitshift of int8, int16, etc?,
David Bateman <=
- Re: bitshift of int8, int16, etc?, John W. Eaton, 2007/06/25
- Re: bitshift of int8, int16, etc?, Daniel J Sebald, 2007/06/25
- Re: bitshift of int8, int16, etc?, Daniel J Sebald, 2007/06/25
- Re: bitshift of int8, int16, etc?, David Bateman, 2007/06/25
- Re: bitshift of int8, int16, etc?, Daniel J Sebald, 2007/06/25
- Re: bitshift of int8, int16, etc?, David Bateman, 2007/06/25
- Re: bitshift of int8, int16, etc?, Daniel J Sebald, 2007/06/25
- Re: bitshift of int8, int16, etc?, Søren Hauberg, 2007/06/25
- Re: bitshift of int8, int16, etc?, John W. Eaton, 2007/06/25
- Re: bitshift of int8, int16, etc?, Daniel J Sebald, 2007/06/25