Thread: C language operation Order Question.
-
Jul 15th, 2005 12:55 PM
#1
C language operation Order Question.
I just have a quicky, i tried to google it but did not find much.
does a bit shift (<<) have higher priority over a power (^), I am trying to code up the Xtea encryption algorithim and I am not sure bout the order.
-
-
Jul 15th, 2005 01:38 PM
#2
nm the (^) is an exclusive OR, now everything makes more sense
-
Jul 15th, 2005 01:54 PM
#3
bitshift has higher priority than exclusive OR, Xtea here I come.
-
Jul 15th, 2005 02:13 PM
#4
-
Jul 15th, 2005 04:19 PM
#5
When in doubt, add some brackets
-
Jul 15th, 2005 04:56 PM
#6
-
Jul 15th, 2005 05:02 PM
#7

Originally Posted by
aquariaguy
Is that even english?!
He did say C.
-
Jul 15th, 2005 05:59 PM
#8
The syntax is C, I already solved all my issues and have successfully implemented xtea.
xtea is an encryption/decryption algorithim, it is supposed to be one of the few cyphers that has not been broken yet. I think xbox uses xtea or a slight variant of it. I was gonna do DES of AES encryption but they are not very computationally friendly. I am using xtea to encrypt my programs so people can not steal my work.
-
Jul 15th, 2005 06:43 PM
#9
the average programmer can't remember the properity of operations (as your post atests to) so ... to be a good programmer, making your code more readable and unambiguous (without having to look it up) ...
Add the brackets !!!
-
Jul 15th, 2005 08:28 PM
#10
I totally agree on adding brackets, I was looking at some reference code that had no brackets. Even the reference code said many people confuse the order of operation, but they still did not clarify.
-
Jul 16th, 2005 02:29 AM
#11
Whew ... glad you are going to make it right. See how much easier the original author of that code would have made it ...
For future reference ... http://www.swansontec.com/sopc.htm and I wouldn't use the comma or Ternary Operator for the same reasons.
-
Jul 19th, 2005 05:58 PM
#12
If by any chance anyone is interested in an XTEA bootloader for AVR, here is my work. It is about 80% complete.
http://www.14point7.com/AVR.htm
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules