Skip to content

Commit

Permalink
setM
Browse files Browse the repository at this point in the history
  • Loading branch information
Baunsgaard committed Oct 21, 2024
1 parent ab45f4d commit f4b4564
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -456,16 +456,19 @@ private static AMapToData createMappingAMapToDataNoNull(Array<?> a, Map<?, Long>

private static AMapToData createMappingAMapToDataWithNull(Array<?> a, Map<?, Long> map, int si, AMapToData m, int start, int end) {
// TODO push down to underlying array if critical performance to allow JIT compilation.
for(int i = start; i < end; i++) {
final Object v = a.get(i);
if(v != null)
m.set(i, map.get(v).intValue() - 1);
else
m.set(i, si);
}
for(int i = start; i < end; i++)
setM(a, map, si, m, i);
return m;
}

private static void setM(Array<?> a, Map<?, Long> map, int si, AMapToData m, int i) {
final Object v = a.get(i);
if(v != null)
m.set(i, map.get(v).intValue() - 1);
else
m.set(i, si);
}

private AMapToData createHashMappingAMapToData(Array<?> a, int k, boolean nulls) {
AMapToData m = MapToFactory.create(a.size(), k + (nulls ? 1 : 0));
if(nulls) {
Expand Down

0 comments on commit f4b4564

Please sign in to comment.