Files
QuickLook/QuickLook.Plugin/QuickLook.Plugin.FontViewer/Typography.OpenFont/BinaryReaderExtensions.cs
2024-12-30 04:21:24 +08:00

19 lines
483 B
C#

using System.IO;
namespace Typography.OpenFont;
internal static class BinaryReaderExtensions
{
public static ushort ReadUInt16BE(this BinaryReader reader)
{
byte[] bytes = reader.ReadBytes(2);
return (ushort)((bytes[0] << 8) | bytes[1]);
}
public static uint ReadUInt32BE(this BinaryReader reader)
{
byte[] bytes = reader.ReadBytes(4);
return (uint)((bytes[0] << 24) | (bytes[1] << 16) | (bytes[2] << 8) | bytes[3]);
}
}