octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 3.0.1 release?


From: David Bateman
Subject: Re: 3.0.1 release?
Date: Tue, 08 Apr 2008 16:41:31 +0200
User-agent: Thunderbird 2.0.0.12 (X11/20080306)

Michael Goffioul wrote:
> On Tue, Apr 8, 2008 at 3:25 PM, Bateman David-ADB014
> <address@hidden> wrote:
>   
>>
>> The code
>>
>>  #include <iostream>
>>  int main (void)
>>  {
>>          uint64_t a = 0x001FFFFFFFFFFFFFUL^0x0007FFFFFFFFFFFFUL;
>>          std::cerr << a  << std::endl;
>>          return 0;
>>  }
>>
>>  returns 6755399441055744, and I suspect it does something else under MSVC
>>     
>
> I added the following line (because MSVC does not have uint64_t, and it is the
> way it is done with octave):
>
> typedef unsigned long long uint64_t;
>
> The result is
>
> 6755399441055744
>
> It seems to match what you expect.
>
> Michael.
>
>   
Then I'm not sure I understand, it is clear that the example

 Bmax = bitmax;
 A = bitshift(Bmax,-2);
 bitxor(cast(A,'uint64'),cast(Bmax,'uint64'))


Is incorrect in the windows version (I used your 3.0 MSVC binary) of
Octave, and that corresponds to the piece of code I sent.. Can you
confirm that this is incorrect under MSVC (that is it doesn't return
6755399441055744). I checked the casts above independently and they are
returning the correct answers, so the issue is in the bitxor function in
src/bitfcns.cc. This calls the code fragment

          uint64NDArray x (args(0).array_value ()); \
          uint64NDArray y (args(1).array_value ());    \
          if (! error_state) \
        BITOPX (OP, FNAME, uint64NDArray); \
          retval = retval.array_value (); \

in the BITOP macro, and BITOPX call a fragment

        for (int i = 0; i < nelx; i++) \
          if (is_scalar_op) \
        for (int k = 0; k < nely; k++) \
          result(i+k) = x(i) OP y(k); \

where "OP" is "^". This then calls the operator ^ from
liboctave/oct-inttypes.h

#define OCTAVE_INT_BITCMP_OP(OP) \
  template <class T> \
  octave_int<T> \
  operator OP (const octave_int<T>& x, const octave_int<T>& y) \
  { \
    return x.value () OP y.value (); \
  }

OCTAVE_INT_BITCMP_OP (^)

where T is of type uint64_t and x.value() returns a value of type
uint64_t. I don't see where this can go wrong and so laid the cause on
the ^ operator for uint64_t types in MSVC. Frankly I'm stumped why this
is wrong under MSVC..

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]