Skip to content

Commit 2e247df

Browse files
author
xiaojun
committed
Update comment
1 parent 99e8779 commit 2e247df

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3507,25 +3507,30 @@ private static ByteString binaryOperator(
35073507
}
35083508

35093509
/**
3510-
* Performs bitwise shift on two integers. Equivalent to: {@code x << (y % 32)} if y >= 0, or
3511-
* {@code x >>> (-y % 32)} if y < 0.
3510+
* Performs bitwise shift on two integers.
3511+
* Equivalent to: {@code x &lt;&lt; (y % 32)} if y &gt;= 0, or
3512+
* {@code x &gt;&gt;&gt; (-y % 32)} if y &lt; 0.
35123513
*/
3514+
35133515
public static int leftShift(int x, int y) {
35143516
int shift = Math.abs(y % 32);
35153517
return y >= 0 ? x << shift : x >>> shift;
35163518
}
35173519

35183520
/**
3519-
* Performs bitwise shift on a long. Equivalent to: {@code x << (y % 64)} if y >= 0, or
3520-
* {@code x >>> (-y % 64)} if y < 0.
3521+
* Performs bitwise shift on two integers.
3522+
* Equivalent to: {@code x &lt;&lt; (y % 64)} if y &gt;= 0, or
3523+
* {@code x &gt;&gt;&gt; (-y % 64)} if y &lt; 0.
35213524
*/
3525+
35223526
public static long leftShift(long x, int y) {
35233527
int shift = Math.abs(y % 64);
35243528
return y >= 0 ? x << shift : x >>> shift;
35253529
}
35263530

35273531
/**
3528-
* Performs bitwise shift with long shift amount. Note: input x is int, so shift mod 32 is used.
3532+
* Performs bitwise shift with long shift amount.
3533+
* Note: input x is int, so shift mod 32 is used.
35293534
* Returns long to prevent overflow.
35303535
*/
35313536
public static long leftShift(int x, long y) {
@@ -3534,16 +3539,18 @@ public static long leftShift(int x, long y) {
35343539
}
35353540

35363541
/**
3537-
* Performs bitwise shift on ByteString input. Returns a new ByteString with shifted bits. If y >=
3538-
* 0: left shift; if y < 0: logical right shift.
3542+
* Performs bitwise shift on ByteString input.
3543+
* Returns a new ByteString with shifted bits. If y &gt;=
3544+
* 0: left shift; if y &lt; 0: logical right shift.
35393545
*/
35403546
public static ByteString leftShift(ByteString bytes, int y) {
35413547
byte[] result = leftShift(bytes.getBytes(), y);
35423548
return new ByteString(result);
35433549
}
35443550

35453551
/**
3546-
* Performs bitwise shift on byte array. If y >= 0: left shift; if y < 0: logical right shift.
3552+
* Performs bitwise shift on byte array.
3553+
* If y &gt;= 0: left shift; if y &lt; 0: logical right shift.
35473554
* Shift amount is modulo 32 bits.
35483555
*/
35493556
public static byte[] leftShift(byte[] bytes, int y) {

0 commit comments

Comments
 (0)