@@ -143,7 +143,7 @@ namespace Discord | |||||
var perms = new List<ChannelPermission>(); | var perms = new List<ChannelPermission>(); | ||||
for (byte i = 0; i < Permissions.MaxBits; i++) | for (byte i = 0; i < Permissions.MaxBits; i++) | ||||
{ | { | ||||
ulong flag = (ulong)Math.Pow(2, i); | |||||
ulong flag = ((ulong)1 << i); | |||||
if ((RawValue & flag) != 0) | if ((RawValue & flag) != 0) | ||||
perms.Add((ChannelPermission)flag); | perms.Add((ChannelPermission)flag); | ||||
} | } | ||||
@@ -1,5 +1,4 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Collections.Generic; | |||||
using System.Diagnostics; | using System.Diagnostics; | ||||
namespace Discord | namespace Discord | ||||
@@ -161,7 +160,7 @@ namespace Discord | |||||
// each of the GuildPermissions increments by 2^i from 0 to MaxBits | // each of the GuildPermissions increments by 2^i from 0 to MaxBits | ||||
for (byte i = 0; i < Permissions.MaxBits; i++) | for (byte i = 0; i < Permissions.MaxBits; i++) | ||||
{ | { | ||||
ulong flag = (ulong)Math.Pow(2, i); | |||||
ulong flag = ((ulong)1 << i); | |||||
if ((RawValue & flag) != 0) | if ((RawValue & flag) != 0) | ||||
perms.Add((GuildPermission)flag); | perms.Add((GuildPermission)flag); | ||||
} | } | ||||
@@ -1,5 +1,4 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Collections.Generic; | |||||
using System.Diagnostics; | using System.Diagnostics; | ||||
namespace Discord | namespace Discord | ||||
@@ -131,7 +130,8 @@ namespace Discord | |||||
var perms = new List<ChannelPermission>(); | var perms = new List<ChannelPermission>(); | ||||
for (byte i = 0; i < Permissions.MaxBits; i++) | for (byte i = 0; i < Permissions.MaxBits; i++) | ||||
{ | { | ||||
ulong flag = (ulong)Math.Pow(2, i); | |||||
// first operand must be long or ulong to shift >31 bits | |||||
ulong flag = ((ulong)1 << i); | |||||
if ((AllowValue & flag) != 0) | if ((AllowValue & flag) != 0) | ||||
perms.Add((ChannelPermission)flag); | perms.Add((ChannelPermission)flag); | ||||
} | } | ||||
@@ -142,7 +142,7 @@ namespace Discord | |||||
var perms = new List<ChannelPermission>(); | var perms = new List<ChannelPermission>(); | ||||
for (byte i = 0; i < Permissions.MaxBits; i++) | for (byte i = 0; i < Permissions.MaxBits; i++) | ||||
{ | { | ||||
ulong flag = (ulong)Math.Pow(2, i); | |||||
ulong flag = ((ulong)1 << i); | |||||
if ((DenyValue & flag) != 0) | if ((DenyValue & flag) != 0) | ||||
perms.Add((ChannelPermission)flag); | perms.Add((ChannelPermission)flag); | ||||
} | } | ||||