Skip to content

Commit

Permalink
Added a method to convert bits to bytes (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
lpeyr committed May 6, 2023
1 parent a5fb341 commit 3d75f2b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions PeyrSharp.Core/Converters/Storage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,5 +132,12 @@ public static class Storage
StorageUnits.Petabyte => value,// Convert and return value
_ => value,// Convert and return value
};

/// <summary>
/// Converts a number of bits to a number of bytes.
/// </summary>
/// <param name="n">The number of bits to convert.</param>
/// <returns>The number of bytes equivalent to n bits.</returns>
public static double BitsToBytes(double n) => n / 8;
}
}

0 comments on commit 3d75f2b

Please sign in to comment.