-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from azimgd/optimize-state
Performance enhancements
- Loading branch information
Showing
36 changed files
with
2,952 additions
and
1,005 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
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,41 @@ | ||
package com.shadowlist; | ||
|
||
public class SLFenwickTree { | ||
static { | ||
System.loadLibrary("react_codegen_SLContainerSpec"); | ||
} | ||
|
||
private long mNativePtr; | ||
|
||
public SLFenwickTree(float[] childrenMeasurements) { | ||
mNativePtr = nativeInit(childrenMeasurements); | ||
} | ||
|
||
private native long nativeInit(float[] childrenMeasurements); | ||
private native void nativeDestroy(long nativePtr); | ||
private native float nativeSum(long nativePtr, int index); | ||
private native int nativeLowerBound(long nativePtr, float offset); | ||
private native int nativeAdjustVisibleStartIndex(long nativePtr, int visibleStartIndex, int childrenMeasurementsTreeSize); | ||
private native int nativeAdjustVisibleEndIndex(long nativePtr, int visibleEndIndex, int childrenMeasurementsTreeSize); | ||
|
||
public float sum(int index) { | ||
return nativeSum(mNativePtr, index); | ||
} | ||
|
||
public int lowerBound(float offset) { | ||
return nativeLowerBound(mNativePtr, offset); | ||
} | ||
|
||
public int adjustVisibleStartIndex(int visibleStartIndex, int childrenMeasurementsTreeSize) { | ||
return nativeAdjustVisibleStartIndex(mNativePtr, visibleStartIndex, childrenMeasurementsTreeSize); | ||
} | ||
|
||
public int adjustVisibleEndIndex(int visibleStartIndex, int childrenMeasurementsTreeSize) { | ||
return nativeAdjustVisibleEndIndex(mNativePtr, visibleStartIndex, childrenMeasurementsTreeSize); | ||
} | ||
|
||
public void destroy() { | ||
nativeDestroy(mNativePtr); | ||
mNativePtr = 0; | ||
} | ||
} |
Oops, something went wrong.