Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6a6df84

Browse files
committed
fix exception in Bits
1 parent 8e47167 commit 6a6df84

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

‎build.gradle‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ tasks.withType(JavaCompile) { options.encoding = "UTF-8" }
2626

2727
group = 'com.github.myibu'
2828
archivesBaseName = "algorithm-java"
29-
version = "1.0.0f"
29+
version = "1.0.0g"
3030

3131
repositories {
3232
mavenCentral()

‎readme.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Reference to: [HoffmanAndGolombCoding.pdf](./docs/HoffmanAndGolombCoding.pdf)
5757
<dependency>
5858
<groupId>com.github.myibu</groupId>
5959
<artifactId>algorithm-java</artifactId>
60-
<version>1.0.0f</version>
60+
<version>1.0.0g</version>
6161
</dependency>
6262
```
6363

‎src/main/java/com/github/myibu/algorithm/data/Bits.java‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ public static Bits ofByte(byte val, int len) {
273273
}
274274

275275
public static Bits ofByte(byte[] val) {
276+
if (val == null || val.length == 0) return new Bits();
276277
int i = 0;
277278
Bits first = ofByte(val[i++]);
278279
for (; i < val.length; i++) {
@@ -300,6 +301,7 @@ public static Bits ofShort(short val, int len) {
300301
}
301302

302303
public static Bits ofShort(short[] val) {
304+
if (val == null || val.length == 0) return new Bits();
303305
int i = 0;
304306
Bits first = ofShort(val[i++]);
305307
for (; i < val.length; i++) {
@@ -327,6 +329,7 @@ public static Bits ofInt(int val, int len) {
327329
}
328330

329331
public static Bits ofInt(int[] val) {
332+
if (val == null || val.length == 0) return new Bits();
330333
int i = 0;
331334
Bits first = ofInt(val[i++]);
332335
for (; i < val.length; i++) {
@@ -406,6 +409,7 @@ public static Bits ofLong(long val, int len) {
406409
}
407410

408411
public static Bits ofLong(long[] val) {
412+
if (val == null || val.length == 0) return new Bits();
409413
int i = 0;
410414
Bits first = ofLong(val[i++]);
411415
for (; i < val.length; i++) {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /