Exemplo n.º 1
0
 // TODO: check for overflow
 public static VoteEnum IncreaseVotesCount(this VoteEnum vote, int diff) => vote
 .RemoveFlags(VoteEnum.Plus)
 .CombineFlags((VoteEnum)((((int)vote.CommonFlags(VoteEnum.Plus) >> FirstPlusBit) + diff) << FirstPlusBit));
Exemplo n.º 2
0
 public static int GetPlusVotesCount(this VoteEnum?vote) =>
 ((int)(vote?.CommonFlags(VoteEnum.Plus) ?? VoteEnum.None) >> FirstPlusBit);