Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port Packed Producing Python Programs, #1008 #1067

Merged
merged 10 commits into from
Dec 22, 2024
9 changes: 5 additions & 4 deletions src/Lucene.Net/Util/Packed/BulkOperation.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Lucene.Net.Diagnostics;
using Lucene.Net.Diagnostics;
using System;

// this file has been automatically generated, DO NOT EDIT
// This file has been automatically generated, DO NOT EDIT

namespace Lucene.Net.Util.Packed
{
Expand Down Expand Up @@ -121,7 +121,7 @@ internal abstract class BulkOperation : PackedInt32s.IDecoder, PackedInt32s.IEnc
new BulkOperationPacked(61),
new BulkOperationPacked(62),
new BulkOperationPacked(63),
new BulkOperationPacked(64)
new BulkOperationPacked(64),
};

// NOTE: this is sparse (some entries are null):
Expand Down Expand Up @@ -157,9 +157,10 @@ internal abstract class BulkOperation : PackedInt32s.IDecoder, PackedInt32s.IEnc
null,
null,
null,
new BulkOperationPackedSingleBlock(32)
new BulkOperationPackedSingleBlock(32),
};


public static BulkOperation Of(PackedInt32s.Format format, int bitsPerValue)
{
if (format == PackedInt32s.Format.PACKED)
Expand Down
9 changes: 4 additions & 5 deletions src/Lucene.Net/Util/Packed/BulkOperationPacked1.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// this file has been automatically generated, DO NOT EDIT
// This file has been automatically generated, DO NOT EDIT

namespace Lucene.Net.Util.Packed
{
Expand Down Expand Up @@ -45,7 +45,7 @@ public override void Decode(byte[] blocks, int blocksOffset, int[] values, int v
{
for (int j = 0; j < iterations; ++j)
{
var block = blocks[blocksOffset++];
byte block = blocks[blocksOffset++];
values[valuesOffset++] = (block >>> 7) & 1;
values[valuesOffset++] = (block >>> 6) & 1;
values[valuesOffset++] = (block >>> 5) & 1;
Expand All @@ -56,15 +56,14 @@ public override void Decode(byte[] blocks, int blocksOffset, int[] values, int v
values[valuesOffset++] = block & 1;
}
}

public override void Decode(long[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations)
{
for (int i = 0; i < iterations; ++i)
{
long block = blocks[blocksOffset++];
for (int shift = 63; shift >= 0; shift -= 1)
{
values[valuesOffset++] = ((block >>> shift)) & 1;
values[valuesOffset++] = (block >>> shift) & 1;
}
}
}
Expand All @@ -73,7 +72,7 @@ public override void Decode(byte[] blocks, int blocksOffset, long[] values, int
{
for (int j = 0; j < iterations; ++j)
{
var block = blocks[blocksOffset++];
byte block = blocks[blocksOffset++];
values[valuesOffset++] = (block >>> 7) & 1;
values[valuesOffset++] = (block >>> 6) & 1;
values[valuesOffset++] = (block >>> 5) & 1;
Expand Down
5 changes: 2 additions & 3 deletions src/Lucene.Net/Util/Packed/BulkOperationPacked10.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// this file has been automatically generated, DO NOT EDIT
// This file has been automatically generated, DO NOT EDIT

namespace Lucene.Net.Util.Packed
{
Expand Down Expand Up @@ -88,13 +88,12 @@ public override void Decode(byte[] blocks, int blocksOffset, int[] values, int v
values[valuesOffset++] = ((byte3 & 3) << 8) | byte4;
}
}

public override void Decode(long[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations)
{
for (int i = 0; i < iterations; ++i)
{
long block0 = blocks[blocksOffset++];
values[valuesOffset++] = (block0 >>> 54);
values[valuesOffset++] = block0 >>> 54;
values[valuesOffset++] = (block0 >>> 44) & 1023L;
values[valuesOffset++] = (block0 >>> 34) & 1023L;
values[valuesOffset++] = (block0 >>> 24) & 1023L;
Expand Down
3 changes: 1 addition & 2 deletions src/Lucene.Net/Util/Packed/BulkOperationPacked11.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// this file has been automatically generated, DO NOT EDIT
// This file has been automatically generated, DO NOT EDIT

namespace Lucene.Net.Util.Packed
{
Expand Down Expand Up @@ -136,7 +136,6 @@ public override void Decode(byte[] blocks, int blocksOffset, int[] values, int v
values[valuesOffset++] = ((byte9 & 7) << 8) | byte10;
}
}

public override void Decode(long[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations)
{
for (int i = 0; i < iterations; ++i)
Expand Down
3 changes: 1 addition & 2 deletions src/Lucene.Net/Util/Packed/BulkOperationPacked12.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// this file has been automatically generated, DO NOT EDIT
// This file has been automatically generated, DO NOT EDIT

namespace Lucene.Net.Util.Packed
{
Expand Down Expand Up @@ -66,7 +66,6 @@ public override void Decode(byte[] blocks, int blocksOffset, int[] values, int v
values[valuesOffset++] = ((byte1 & 15) << 8) | byte2;
}
}

public override void Decode(long[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations)
{
for (int i = 0; i < iterations; ++i)
Expand Down
3 changes: 1 addition & 2 deletions src/Lucene.Net/Util/Packed/BulkOperationPacked13.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// this file has been automatically generated, DO NOT EDIT
// This file has been automatically generated, DO NOT EDIT

namespace Lucene.Net.Util.Packed
{
Expand Down Expand Up @@ -140,7 +140,6 @@ public override void Decode(byte[] blocks, int blocksOffset, int[] values, int v
values[valuesOffset++] = ((byte11 & 31) << 8) | byte12;
}
}

public override void Decode(long[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations)
{
for (int i = 0; i < iterations; ++i)
Expand Down
3 changes: 1 addition & 2 deletions src/Lucene.Net/Util/Packed/BulkOperationPacked14.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// this file has been automatically generated, DO NOT EDIT
// This file has been automatically generated, DO NOT EDIT

namespace Lucene.Net.Util.Packed
{
Expand Down Expand Up @@ -92,7 +92,6 @@ public override void Decode(byte[] blocks, int blocksOffset, int[] values, int v
values[valuesOffset++] = ((byte5 & 63) << 8) | byte6;
}
}

public override void Decode(long[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations)
{
for (int i = 0; i < iterations; ++i)
Expand Down
3 changes: 1 addition & 2 deletions src/Lucene.Net/Util/Packed/BulkOperationPacked15.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// this file has been automatically generated, DO NOT EDIT
// This file has been automatically generated, DO NOT EDIT

namespace Lucene.Net.Util.Packed
{
Expand Down Expand Up @@ -144,7 +144,6 @@ public override void Decode(byte[] blocks, int blocksOffset, int[] values, int v
values[valuesOffset++] = ((byte13 & 127) << 8) | byte14;
}
}

public override void Decode(long[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations)
{
for (int i = 0; i < iterations; ++i)
Expand Down
3 changes: 1 addition & 2 deletions src/Lucene.Net/Util/Packed/BulkOperationPacked16.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// this file has been automatically generated, DO NOT EDIT
// This file has been automatically generated, DO NOT EDIT

namespace Lucene.Net.Util.Packed
{
Expand Down Expand Up @@ -48,7 +48,6 @@ public override void Decode(byte[] blocks, int blocksOffset, int[] values, int v
values[valuesOffset++] = ((blocks[blocksOffset++] & 0xFF) << 8) | (blocks[blocksOffset++] & 0xFF);
}
}

public override void Decode(long[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations)
{
for (int i = 0; i < iterations; ++i)
Expand Down
3 changes: 1 addition & 2 deletions src/Lucene.Net/Util/Packed/BulkOperationPacked17.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// this file has been automatically generated, DO NOT EDIT
// This file has been automatically generated, DO NOT EDIT

namespace Lucene.Net.Util.Packed
{
Expand Down Expand Up @@ -148,7 +148,6 @@ public override void Decode(byte[] blocks, int blocksOffset, int[] values, int v
values[valuesOffset++] = ((byte14 & 1) << 16) | (byte15 << 8) | byte16;
}
}

public override void Decode(long[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations)
{
for (int i = 0; i < iterations; ++i)
Expand Down
3 changes: 1 addition & 2 deletions src/Lucene.Net/Util/Packed/BulkOperationPacked18.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// this file has been automatically generated, DO NOT EDIT
// This file has been automatically generated, DO NOT EDIT

namespace Lucene.Net.Util.Packed
{
Expand Down Expand Up @@ -96,7 +96,6 @@ public override void Decode(byte[] blocks, int blocksOffset, int[] values, int v
values[valuesOffset++] = ((byte6 & 3) << 16) | (byte7 << 8) | byte8;
}
}

public override void Decode(long[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations)
{
for (int i = 0; i < iterations; ++i)
Expand Down
3 changes: 1 addition & 2 deletions src/Lucene.Net/Util/Packed/BulkOperationPacked19.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// this file has been automatically generated, DO NOT EDIT
// This file has been automatically generated, DO NOT EDIT

namespace Lucene.Net.Util.Packed
{
Expand Down Expand Up @@ -152,7 +152,6 @@ public override void Decode(byte[] blocks, int blocksOffset, int[] values, int v
values[valuesOffset++] = ((byte16 & 7) << 16) | (byte17 << 8) | byte18;
}
}

public override void Decode(long[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations)
{
for (int i = 0; i < iterations; ++i)
Expand Down
7 changes: 3 additions & 4 deletions src/Lucene.Net/Util/Packed/BulkOperationPacked2.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// this file has been automatically generated, DO NOT EDIT
// This file has been automatically generated, DO NOT EDIT

namespace Lucene.Net.Util.Packed
{
Expand Down Expand Up @@ -45,14 +45,13 @@ public override void Decode(byte[] blocks, int blocksOffset, int[] values, int v
{
for (int j = 0; j < iterations; ++j)
{
var block = blocks[blocksOffset++];
byte block = blocks[blocksOffset++];
values[valuesOffset++] = (block >>> 6) & 3;
values[valuesOffset++] = (block >>> 4) & 3;
values[valuesOffset++] = (block >>> 2) & 3;
values[valuesOffset++] = block & 3;
}
}

public override void Decode(long[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations)
{
for (int i = 0; i < iterations; ++i)
Expand All @@ -69,7 +68,7 @@ public override void Decode(byte[] blocks, int blocksOffset, long[] values, int
{
for (int j = 0; j < iterations; ++j)
{
var block = blocks[blocksOffset++];
byte block = blocks[blocksOffset++];
values[valuesOffset++] = (block >>> 6) & 3;
values[valuesOffset++] = (block >>> 4) & 3;
values[valuesOffset++] = (block >>> 2) & 3;
Expand Down
3 changes: 1 addition & 2 deletions src/Lucene.Net/Util/Packed/BulkOperationPacked20.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// this file has been automatically generated, DO NOT EDIT
// This file has been automatically generated, DO NOT EDIT

namespace Lucene.Net.Util.Packed
{
Expand Down Expand Up @@ -70,7 +70,6 @@ public override void Decode(byte[] blocks, int blocksOffset, int[] values, int v
values[valuesOffset++] = ((byte2 & 15) << 16) | (byte3 << 8) | byte4;
}
}

public override void Decode(long[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations)
{
for (int i = 0; i < iterations; ++i)
Expand Down
3 changes: 1 addition & 2 deletions src/Lucene.Net/Util/Packed/BulkOperationPacked21.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// this file has been automatically generated, DO NOT EDIT
// This file has been automatically generated, DO NOT EDIT

namespace Lucene.Net.Util.Packed
{
Expand Down Expand Up @@ -156,7 +156,6 @@ public override void Decode(byte[] blocks, int blocksOffset, int[] values, int v
values[valuesOffset++] = ((byte18 & 31) << 16) | (byte19 << 8) | byte20;
}
}

public override void Decode(long[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations)
{
for (int i = 0; i < iterations; ++i)
Expand Down
3 changes: 1 addition & 2 deletions src/Lucene.Net/Util/Packed/BulkOperationPacked22.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// this file has been automatically generated, DO NOT EDIT
// This file has been automatically generated, DO NOT EDIT

namespace Lucene.Net.Util.Packed
{
Expand Down Expand Up @@ -100,7 +100,6 @@ public override void Decode(byte[] blocks, int blocksOffset, int[] values, int v
values[valuesOffset++] = ((byte8 & 63) << 16) | (byte9 << 8) | byte10;
}
}

public override void Decode(long[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations)
{
for (int i = 0; i < iterations; ++i)
Expand Down
3 changes: 1 addition & 2 deletions src/Lucene.Net/Util/Packed/BulkOperationPacked23.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// this file has been automatically generated, DO NOT EDIT
// This file has been automatically generated, DO NOT EDIT

namespace Lucene.Net.Util.Packed
{
Expand Down Expand Up @@ -160,7 +160,6 @@ public override void Decode(byte[] blocks, int blocksOffset, int[] values, int v
values[valuesOffset++] = ((byte20 & 127) << 16) | (byte21 << 8) | byte22;
}
}

public override void Decode(long[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations)
{
for (int i = 0; i < iterations; ++i)
Expand Down
3 changes: 1 addition & 2 deletions src/Lucene.Net/Util/Packed/BulkOperationPacked24.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// this file has been automatically generated, DO NOT EDIT
// This file has been automatically generated, DO NOT EDIT

namespace Lucene.Net.Util.Packed
{
Expand Down Expand Up @@ -57,7 +57,6 @@ public override void Decode(byte[] blocks, int blocksOffset, int[] values, int v
values[valuesOffset++] = (byte0 << 16) | (byte1 << 8) | byte2;
}
}

public override void Decode(long[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations)
{
for (int i = 0; i < iterations; ++i)
Expand Down
3 changes: 1 addition & 2 deletions src/Lucene.Net/Util/Packed/BulkOperationPacked3.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// this file has been automatically generated, DO NOT EDIT
// This file has been automatically generated, DO NOT EDIT

namespace Lucene.Net.Util.Packed
{
Expand Down Expand Up @@ -120,7 +120,6 @@ public override void Decode(byte[] blocks, int blocksOffset, int[] values, int v
values[valuesOffset++] = byte2 & 7;
}
}

public override void Decode(long[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations)
{
for (int i = 0; i < iterations; ++i)
Expand Down
7 changes: 3 additions & 4 deletions src/Lucene.Net/Util/Packed/BulkOperationPacked4.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// this file has been automatically generated, DO NOT EDIT
// This file has been automatically generated, DO NOT EDIT

namespace Lucene.Net.Util.Packed
{
Expand Down Expand Up @@ -45,12 +45,11 @@ public override void Decode(byte[] blocks, int blocksOffset, int[] values, int v
{
for (int j = 0; j < iterations; ++j)
{
var block = blocks[blocksOffset++];
byte block = blocks[blocksOffset++];
values[valuesOffset++] = (block >>> 4) & 15;
values[valuesOffset++] = block & 15;
}
}

public override void Decode(long[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations)
{
for (int i = 0; i < iterations; ++i)
Expand All @@ -67,7 +66,7 @@ public override void Decode(byte[] blocks, int blocksOffset, long[] values, int
{
for (int j = 0; j < iterations; ++j)
{
var block = blocks[blocksOffset++];
byte block = blocks[blocksOffset++];
values[valuesOffset++] = (block >>> 4) & 15;
values[valuesOffset++] = block & 15;
}
Expand Down
3 changes: 1 addition & 2 deletions src/Lucene.Net/Util/Packed/BulkOperationPacked5.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// this file has been automatically generated, DO NOT EDIT
// This file has been automatically generated, DO NOT EDIT

namespace Lucene.Net.Util.Packed
{
Expand Down Expand Up @@ -124,7 +124,6 @@ public override void Decode(byte[] blocks, int blocksOffset, int[] values, int v
values[valuesOffset++] = byte4 & 31;
}
}

public override void Decode(long[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations)
{
for (int i = 0; i < iterations; ++i)
Expand Down
3 changes: 1 addition & 2 deletions src/Lucene.Net/Util/Packed/BulkOperationPacked6.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// this file has been automatically generated, DO NOT EDIT
// This file has been automatically generated, DO NOT EDIT

namespace Lucene.Net.Util.Packed
{
Expand Down Expand Up @@ -84,7 +84,6 @@ public override void Decode(byte[] blocks, int blocksOffset, int[] values, int v
values[valuesOffset++] = byte2 & 63;
}
}

public override void Decode(long[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations)
{
for (int i = 0; i < iterations; ++i)
Expand Down
Loading
Loading