Fix bad flag parsing on attachment pointers.

This commit is contained in:
Alex Hart
2021-04-22 14:46:20 -03:00
committed by GitHub
parent a4868602b5
commit bf124b87fa
8 changed files with 86 additions and 11 deletions
@@ -0,0 +1,19 @@
package org.whispersystems.util;
public final class FlagUtil {
private FlagUtil() {}
/**
* Left shift 1 by 'flag' - 1 spaces.
*
* Examples:
* 1 -> 0001
* 2 -> 0010
* 3 -> 0100
* 4 -> 1000
*/
public static int toBinaryFlag(int flag) {
return 1 << (flag - 1);
}
}