Turned many of the helper methods into extension methods

git-svn-id: file:///srv/devel/repo-conversion/nusu@209 d2e56fa2-650e-0410-a79f-9358c0239efd
This commit is contained in:
Markus Ewald 2010-11-20 11:53:25 +00:00
parent 483184ee78
commit 22cea75a7a
5 changed files with 15 additions and 76 deletions

View file

@ -29,14 +29,14 @@ namespace Nuclex.Support {
/// <summary>Returns the next highest power of 2 from the specified value</summary>
/// <param name="value">Value of which to return the next highest power of 2</param>
/// <returns>The next highest power of 2 to the value</returns>
public static long NextPowerOf2(long value) {
public static long NextPowerOf2(this long value) {
return (long)NextPowerOf2((ulong)value);
}
/// <summary>Returns the next highest power of 2 from the specified value</summary>
/// <param name="value">Value of which to return the next highest power of 2</param>
/// <returns>The next highest power of 2 to the value</returns>
public static ulong NextPowerOf2(ulong value) {
public static ulong NextPowerOf2(this ulong value) {
if(value == 0)
return 1;
@ -55,14 +55,14 @@ namespace Nuclex.Support {
/// <summary>Returns the next highest power of 2 from the specified value</summary>
/// <param name="value">Value of which to return the next highest power of 2</param>
/// <returns>The next highest power of 2 to the value</returns>
public static int NextPowerOf2(int value) {
public static int NextPowerOf2(this int value) {
return (int)NextPowerOf2((uint)value);
}
/// <summary>Returns the next highest power of 2 from the specified value</summary>
/// <param name="value">Value of which to return the next highest power of 2</param>
/// <returns>The next highest power of 2 to the value</returns>
public static uint NextPowerOf2(uint value) {
public static uint NextPowerOf2(this uint value) {
if(value == 0)
return 1;