Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 6 of 6 total |
XOR operations confused with OR |
Wed, Feb 10 2021 12:20 PM | Permanent Link |
Jose Verger Cybernav | Hello,
I made the upgrade from EWB2 to EWB3, and I just found that all places where I wrote something like: A xor $FF result in $FF, regardless of the value of A, so, it means that the compiler is doing an OR operation instead of a XOR. Regards |
Wed, Feb 10 2021 1:37 PM | Permanent Link |
Raul Team Elevate | On 2/10/2021 12:20 PM, Cybernav wrote:
> I made the upgrade from EWB2 to EWB3, and I just found that all places where I wrote something like: A xor $FF > result in $FF, regardless of the value of A, so, it means that the compiler is doing an OR operation instead of a XOR. Can you supply a sample values ? I ran this here (i,j,b are integer) : b := $FF; for i := 0 to 255 do begin j := i XOR b; log(inttostr(j)); end; and got 255 254 ... 1 0 which looks ok Raul |
Wed, Feb 10 2021 2:05 PM | Permanent Link |
Jose Verger Cybernav | Hello Raul, I wrote this small program to display calculations:
unit HttpU; interface uses WebCore, WebUI, WebHTTP, WebForms, WebCtrls, WebBrwsr, WebCtnrs; type TForm1 = class(TDialog) procedure Form1Show(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation const Num=$80; procedure TForm1.Form1Show(Sender: TObject); begin logoutput('A'+IntToStr(Num xor $FF)); logoutput('B'+IntToStr($80 xor $FF)); end; end. And in the output window bellow it displays the following: [Internal] Log output: A255 [Internal] Log output: B255 |
Wed, Feb 10 2021 3:37 PM | Permanent Link |
Raul Team Elevate | On 2/10/2021 2:05 PM, JoseV wrote:
> Hello Raul, I wrote this small program to display calculations: Thanks > const Num=$80; > > procedure TForm1.Form1Show(Sender: TObject); > begin > logoutput('A'+IntToStr(Num xor $FF)); > logoutput('B'+IntToStr($80 xor $FF)); > end; > Looks to be a but with type interference or casting or such This works OK and returns B127 var b:integer; begin b := Num; logoutput( ('B'+IntToStr(b xor $FF))); end; Raul |
Wed, Feb 10 2021 4:03 PM | Permanent Link |
erickengelke | Raul wrote:
On 2/10/2021 2:05 PM, JoseV wrote: > Hello Raul, I wrote this small program to display calculations: >This works OK and returns B127 If you look at the generated javascript, the Y XOR $FF is evaluated at compile time, not at runtime if Y is a constant. Declaring Y as a variable seems to fix it. Yeah, a small bug. Erick EWB Programming Books and Component Library http://www.erickengelke.com |
Thu, Feb 11 2021 11:17 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Erick,
<< If you look at the generated javascript, the Y XOR $FF is evaluated at compile time, not at runtime if Y is a constant. >> Yep, that's the issue - the constant folding in the compiler has an error in how it is evaluating xor operations. The workaround is as-described. A fix will be in build 2 shortly. Thanks, Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Monday, October 14, 2024 at 05:15 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |