what does (x<<13) ^ x mean?
What language is this expression and what does it mean?
x 开发者_JAVA技巧= (x << 13) ^x;
It could be any number of languages. In C
and several other languages, <<
is a left-shift operator, and ^
is a bitwise XOR operator.
Both <<
and ^
( left-shift and xor respectively) are bitwise operators and many languages like C, C++, Java have them
http://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B#Bitwise_operators
In C, this would be "left shift x by 13 binary places, and take the XOR of this and x".
It is any C-derived language.
It means that the author only knows part of C. Otherwise they’d’ve written
x ^= x << 13;
to xor something with itself multiplied by 2¹³.
What language is this expression
That is C syntax. This could be any C-based programming language (C, C++, C#, Java, JavaScript). However, this is not PHP or Perl because sigils are not used.
what does it mean?
I actually can't read that code either - syntactic languages such as C are very hard to read. From what I understand from what other people said this is equivalent to:
(bit-xor (bit-shift-left x 13) x)
精彩评论