Page 1 of 1

unsigned64 bit operations

Posted: 14 Sep 2019 18:02
by Martin Meyer
Hello Thomas,

updating my code to the new bit operations I came upon a case with an unexpected result (in build 902):

Code: Select all

    open bit   class predicates     getHighBitMask64_oldStyle : (unsigned64 X) -> unsigned64 Mask. clauses     getHighBitMask64_oldStyle(X) = bitAnd(X_7, bitNot(bitRight(X_7, 1))) :-         X_1 = bitOr(X, bitRight(X, 1)),         X_2 = bitOr(X_1, bitRight(X_1, 1)),         X_3 = bitOr(X_2, bitRight(X_2, 2)),         X_4 = bitOr(X_3, bitRight(X_3, 4)),         X_5 = bitOr(X_4, bitRight(X_4, 8)),         X_6 = bitOr(X_5, bitRight(X_5, 16)),         X_7 = bitOr(X_6, bitRight(X_6, 32)).   class predicates     getHighBitMask64_newStyle : (unsigned64 X) -> unsigned64 Mask. clauses     getHighBitMask64_newStyle(X) = X_7 ** ~~(X_7 >> 1) :-         X_1 = X ++ X >> 1,         X_2 = X_1 ++ X_1 >> 1,         X_3 = X_2 ++ X_2 >> 2,         X_4 = X_3 ++ X_3 >> 4,         X_5 = X_4 ++ X_4 >> 8,         X_6 = X_5 ++ X_5 >> 16,         X_7 = X_6 ++ X_6 >> 32.   clauses     run() :-         X = 4,         Result_oldStyle = getHighBitMask64_oldStyle(X),         Result_newStyle = getHighBitMask64_newStyle(X),         stdIO::write(Result_oldStyle, '/', Result_newStyle).
In 32bit mode it outputs 4/4, but in 64bit mode 4/7.

Re: unsigned64 bit operations

Posted: 7 Oct 2019 22:25
by Thomas Linder Puls
Thank you. We will look at it.

Re: unsigned64 bit operations

Posted: 26 May 2020 15:58
by Thomas Linder Puls
This problem has been solved, but unfortunately we forgot to merge it into Vip 9 (903-905).

Re: unsigned64 bit operations

Posted: 2 Jun 2020 8:17
by Thomas Linder Puls
This problem is solved in Visual Prolog 9 build 906.