Skip to content

Commit c9a5f5d

Browse files
committed
Reverted back to previous exception
1 parent 1fdb455 commit c9a5f5d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/java/com/pgvector/PGbit.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public PGbit() {
3333
public PGbit(boolean[] v) {
3434
this();
3535
length = v.length;
36-
data = new byte[Math.addExact(length, 7) / 8];
36+
data = new byte[(length + 7) / 8];
3737
for (int i = 0; i < length; i++) {
3838
data[i / 8] |= (v[i] ? 1 : 0) << (7 - (i % 8));
3939
}
@@ -69,7 +69,7 @@ public void setValue(String s) throws SQLException {
6969
data = null;
7070
} else {
7171
length = s.length();
72-
data = new byte[Math.addExact(length, 7) / 8];
72+
data = new byte[(length + 7) / 8];
7373
for (int i = 0; i < length; i++) {
7474
data[i / 8] |= (s.charAt(i) != '0' ? 1 : 0) << (7 - (i % 8));
7575
}
@@ -103,7 +103,7 @@ public int lengthInBytes() {
103103
*/
104104
public void setByteValue(byte[] value, int offset) throws SQLException {
105105
length = ByteConverter.int4(value, offset);
106-
data = new byte[Math.addExact(length, 7) / 8];
106+
data = new byte[(length + 7) / 8];
107107
for (int i = 0; i < data.length; i++) {
108108
data[i] = value[offset + 4 + i];
109109
}

0 commit comments

Comments
 (0)