Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/quite/humla.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Peugnet <nicolas.peugnet@lip6.fr>2024-01-09 20:30:54 +0300
committerNicolas Peugnet <nicolas.peugnet@lip6.fr>2024-01-10 18:00:28 +0300
commit2ddc4865c03e35a67e57dab6614b668e46ce0099 (patch)
tree4d6a1615ba1e739e806a766357d3e3912b92c570
parente15cf4c0c89aff78ee924314883ec8bc244039f2 (diff)
Make WhisperTargetList work for real
- The takenIds bitset was never updated - The 30th ID could not be used - The takenIds calculation in get was reversed
-rw-r--r--src/main/java/se/lublin/humla/model/WhisperTargetList.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main/java/se/lublin/humla/model/WhisperTargetList.java b/src/main/java/se/lublin/humla/model/WhisperTargetList.java
index e76cc0a..172999a 100644
--- a/src/main/java/se/lublin/humla/model/WhisperTargetList.java
+++ b/src/main/java/se/lublin/humla/model/WhisperTargetList.java
@@ -42,7 +42,7 @@ public class WhisperTargetList {
*/
public byte append(WhisperTarget target) {
byte freeId = -1;
- for (byte i = TARGET_MIN; i < TARGET_MAX; i++) {
+ for (byte i = TARGET_MIN; i <= TARGET_MAX; i++) {
if ((mTakenIds & (1 << i)) == 0) {
freeId = i;
break;
@@ -50,13 +50,14 @@ public class WhisperTargetList {
}
if (freeId != -1) {
mActiveTargets[freeId - TARGET_MIN] = target;
+ mTakenIds |= (1 << freeId);
}
return freeId;
}
public WhisperTarget get(byte id) {
- if ((mTakenIds & (1 << id)) > 0)
+ if ((mTakenIds & (1 << id)) == 0)
return null;
return mActiveTargets[id - TARGET_MIN];
}