Discussions related to Visual Prolog
Martin Meyer
VIP Member
Posts: 328
Joined: 14 Nov 2002 0:01

unsigned64 bit operations

Unread post 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.
Regards Martin
User avatar
Thomas Linder Puls
VIP Member
Posts: 1398
Joined: 28 Feb 2000 0:01

Re: unsigned64 bit operations

Unread post by Thomas Linder Puls »

Thank you. We will look at it.
Regards Thomas Linder Puls
PDC
User avatar
Thomas Linder Puls
VIP Member
Posts: 1398
Joined: 28 Feb 2000 0:01

Re: unsigned64 bit operations

Unread post by Thomas Linder Puls »

This problem has been solved, but unfortunately we forgot to merge it into Vip 9 (903-905).
Regards Thomas Linder Puls
PDC
User avatar
Thomas Linder Puls
VIP Member
Posts: 1398
Joined: 28 Feb 2000 0:01

Re: unsigned64 bit operations

Unread post by Thomas Linder Puls »

This problem is solved in Visual Prolog 9 build 906.
Regards Thomas Linder Puls
PDC
Post Reply