Needing some pointer on primitive data handling.

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
sfitzjava
Posts: 8
Joined: Fri Feb 06, 2009 8:02 am

Needing some pointer on primitive data handling.

Post by sfitzjava » Fri Nov 06, 2009 8:33 pm

So I'm trying to mask one value with another such as taking two text values and bitwise anding them.

put 1234530530 into val1
put fileCRC.bin(txtfile) into val2 // this function calcs the CRC of a file.
put val1 bitAnd val2 into val3

Something like the above.

ukimiku
Posts: 101
Joined: Thu Oct 22, 2009 10:45 am

Post by ukimiku » Fri Nov 06, 2009 10:01 pm

Hi, sfitzjava,

please write also where you perceive a problem with your attempt. So far, the bitAnd should work just fine. Was it pseudo-code that you wrote?

Regards,

sfitzjava
Posts: 8
Joined: Fri Feb 06, 2009 8:02 am

Post by sfitzjava » Sun Nov 08, 2009 11:26 pm

I get an error: "bitAnd: error in left operand"

however my CRC value is a mashup of characters in the debugger which is the left operand, and my right operand is a nice looking number.

However the same error if I use binaryEncoding("M",bigNum) and the right operand is a mashup of characters. (I'm assuming this is the binary rep of the number)

-sf

UPDATE:
Got it worked out. Like ukimiku said I had the pseudo correct. A lot of differences between Java and RevTalk. :) But there may be an issue with the bitAnd and bitXor commands error messages. They say the left operand, and I figured it was the one before the command. Seems the right operand was the issue. I was using an index and was starting it at 0. This is from Java where arrays are zero based, except when dealing with SQL. :) Good now I don't have that little conversion to always do.

Any way once I changed it to start at 1 things started to work.

Post Reply