-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
59 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
convex-core/src/main/java/convex/core/data/impl/RepeatByteBlob.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package convex.core.data.impl; | ||
|
||
import org.bouncycastle.util.Arrays; | ||
|
||
public class RepeatByteBlob extends ADerivedBlob { | ||
private final byte b; | ||
|
||
protected RepeatByteBlob(long count, byte b) { | ||
super(count); | ||
this.b=b; | ||
} | ||
|
||
@Override | ||
public RepeatByteBlob sliceImpl(long start, long end) { | ||
return new RepeatByteBlob(end-start,b); | ||
} | ||
|
||
@Override | ||
public int getBytes(byte[] dest, int destOffset) { | ||
int end=destOffset+size(); | ||
Arrays.fill(dest, destOffset,end,(byte)0); | ||
return end; | ||
} | ||
|
||
@Override | ||
public byte byteAtUnchecked(long i) { | ||
return b; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters