Skip to content

Commit

Permalink
Reverted back to previous exception
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Jul 17, 2024
1 parent 1fdb455 commit c9a5f5d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/java/com/pgvector/PGbit.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public PGbit() {
public PGbit(boolean[] v) {
this();
length = v.length;
data = new byte[Math.addExact(length, 7) / 8];
data = new byte[(length + 7) / 8];
for (int i = 0; i < length; i++) {
data[i / 8] |= (v[i] ? 1 : 0) << (7 - (i % 8));
}
Expand Down Expand Up @@ -69,7 +69,7 @@ public void setValue(String s) throws SQLException {
data = null;
} else {
length = s.length();
data = new byte[Math.addExact(length, 7) / 8];
data = new byte[(length + 7) / 8];
for (int i = 0; i < length; i++) {
data[i / 8] |= (s.charAt(i) != '0' ? 1 : 0) << (7 - (i % 8));
}
Expand Down Expand Up @@ -103,7 +103,7 @@ public int lengthInBytes() {
*/
public void setByteValue(byte[] value, int offset) throws SQLException {
length = ByteConverter.int4(value, offset);
data = new byte[Math.addExact(length, 7) / 8];
data = new byte[(length + 7) / 8];
for (int i = 0; i < data.length; i++) {
data[i] = value[offset + 4 + i];
}
Expand Down

0 comments on commit c9a5f5d

Please sign in to comment.