Could I Ask about JEP 438 Vector API no suport BitSet problem?
Latch Wu
latchwu at gmail.com
Sun Apr 14 02:16:44 UTC 2024
Hi Paul Sandoz, I am Master student. I was use Vector API and
Java.util.BitSet on Project. there are have big trouble. Vector API no
support BitSet_Vector
every time, I must be transfer BitSet.toByteArray()
in this case, because BitSet no support Vector API
I need to do something unproductive,
var aBytes = (BitSet) bs1.toByteArray();
var bBytes = (BitSet) bs2.toByteArray();
byte[] c = new byte[bs1.getByteArray().length];
final VectorSpecies<Byte> SPECIES = ByteVector.SPECIES_MAX;
for (int k = 0; k < aBytes.length; k += SPECIES.length()) {
var m = SPECIES.indexInRange(k, aBytes.length);
va = ByteVector.fromArray(SPECIES, aBytes, k, m);
vb = ByteVector.fromArray(SPECIES, bBytes, k, m);
vc = va.and(vb);
vc.intoArray(c, k, m);
}
byte[] newC = c.clone();
BitSet temp = BitSet.valueOf(newC);
================================================================
var aBytes = (BitSet) bs1;
var aByteClone = (BitSet) aBytes.clone();
var bBytes = (BitSet) bs2;
var ceqAandB = (BitSet) bBytes.clone();
CeqAandB.and(aByteClone);
================================================================
If I use the following code, it is faster than using AVX-512 Vectory API
Could you have any suggestion for me?
Best regard,
Latch Wu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/panama-dev/attachments/20240414/a5351d19/attachment.htm>
More information about the panama-dev
mailing list