Move IsPowerOf2 to Exts.

This commit is contained in:
Paul Chote
2013-06-08 11:46:44 +12:00
parent da8202a15e
commit cd268c11ee
2 changed files with 8 additions and 11 deletions

View File

@@ -137,6 +137,11 @@ namespace OpenRA
return v;
}
public static bool IsPowerOf2(int v)
{
return (v & (v - 1)) == 0;
}
public static Size NextPowerOf2(this Size s) { return new Size(NextPowerOf2(s.Width), NextPowerOf2(s.Height)); }
public static string JoinWith<T>(this IEnumerable<T> ts, string j)