查看 Operator overloading. 对于按位操作(bitwise operation),没有特别的符号来表示,而是直接使用命名函数: 代码语言:javascript 代码运行次数:0 运行 AI代码解释 val x = (1 shl 2) and 0x000FF000 这是完整的位运算操作 (只能对 Int 或者Long 使用): shl(bits) –signed shift left (Java's <<) shr...
or(bits) – bitwise or xor(bits) – bitwise xor inv() – bitwise inversion These functions are available forIntandLongtypes only. Thebitwise and operationperforms bit-by-bit comparison between two numbers. The result for a bit position is 1 only if both corresponding bits in the operands ar...
Kotlin支持标准的算数操作符,并在相应的类上定义为成员函数(但编译器会针对运算进行优化,将函数调用优化成直接的算数操作)。 查看Operator overloading. 对于按位操作(bitwise operation),没有特别的符号来表示,而是直接使用命名函数: val x = (1 shl 2) and 0x000FF000 1. 这是完整的位运...
/** Performs a bitwise AND operation between the two values. */ public infix fun and(other: Long): Long /** Performs a bitwise OR operation between the two values. */ public infix fun or(other: Long): Long /** Performs a bitwise XOR operation between the two values. */ public infi...
查看 Operator overloading. 对于按位操作(bitwise operation),没有特别的符号来表示,而是直接使用命名函数: 代码语言:javascript 代码运行次数:0 运行 AI代码解释 val x = (1 shl 2) and 0x000FF000 这是完整的位运算操作 (只能对 Int 或者Long 使用): shl(bits) –signed shift left (Java's <<) shr...
查看Operator overloading. 对于按位操作(bitwise operation),没有特别的符号来表示,而是直接使用命名函数: valx = (1shl2) and0x000FF000 这是完整的位运算操作 (只能对Int或者Long使用): shl(bits)– signed shift left (Java's<<) shr(bits)– signed shift right (Java's>>) ...
查看Operator overloading. 对于按位操作(bitwise operation),没有特别的符号来表示,而是直接使用命名函数: valx = (1shl2) and0x000FF000 这是完整的位运算操作 (只能对Int或者Long使用): shl(bits)– signed shift left (Java's<<) shr(bits)– signed shift right (Java's>>) ...
Bitwise Operator Unlike Java, there are no bitwise and bitshift operators in Kotlin. To perform these tasks, various functions (supporting infix notation) are there. Named Function Description Expression shl Signed Shift Left a.shl(b) shr Signed Shift Right a.shr(b) ushr Unsigned Shift Rig...
An operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations. Kotlin is rich in built-in operators and provide the following types of operators:Arithmetic Operators Relational Operators Assignment Operators Unary Operators Logical Operators Bitwise Operations...
bits) – bitwise and or(bits) – bitwise or xor(bits) – bitwise xor inv() – bitwise ...