Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.IO;
- using System.Runtime.CompilerServices;
- namespace Reloaded.Memory.Utilities
- {
- public partial class ExtendedMemoryStream
- {
- /// <summary>
- /// Appends an unmanaged structure onto the <see cref="MemoryStream"/> and advances the position.
- /// </summary>
- public void WriteBigEndianPrimitive(byte structure)
- {
- structure = Endian.Reverse(structure);
- Write(Struct.GetBytes(structure));
- }
- /// <summary>
- /// Appends an unmanaged structure onto the <see cref="MemoryStream"/> and advances the position.
- /// </summary>
- public void WriteBigEndianPrimitive(sbyte structure)
- {
- structure = Endian.Reverse(structure);
- Write(Struct.GetBytes(structure));
- }
- /// <summary>
- /// Appends an unmanaged structure onto the <see cref="MemoryStream"/> and advances the position.
- /// </summary>
- public void WriteBigEndianPrimitive(short structure)
- {
- structure = Endian.Reverse(structure);
- Write(Struct.GetBytes(structure));
- }
- /// <summary>
- /// Appends an unmanaged structure onto the <see cref="MemoryStream"/> and advances the position.
- /// </summary>
- public void WriteBigEndianPrimitive(ushort structure)
- {
- structure = Endian.Reverse(structure);
- Write(Struct.GetBytes(structure));
- }
- /// <summary>
- /// Appends an unmanaged structure onto the <see cref="MemoryStream"/> and advances the position.
- /// </summary>
- public void WriteBigEndianPrimitive(int structure)
- {
- structure = Endian.Reverse(structure);
- Write(Struct.GetBytes(structure));
- }
- /// <summary>
- /// Appends an unmanaged structure onto the <see cref="MemoryStream"/> and advances the position.
- /// </summary>
- public void WriteBigEndianPrimitive(uint structure)
- {
- structure = Endian.Reverse(structure);
- Write(Struct.GetBytes(structure));
- }
- /// <summary>
- /// Appends an unmanaged structure onto the <see cref="MemoryStream"/> and advances the position.
- /// </summary>
- public void WriteBigEndianPrimitive(long structure)
- {
- structure = Endian.Reverse(structure);
- Write(Struct.GetBytes(structure));
- }
- /// <summary>
- /// Appends an unmanaged structure onto the <see cref="MemoryStream"/> and advances the position.
- /// </summary>
- public void WriteBigEndianPrimitive(ulong structure)
- {
- structure = Endian.Reverse(structure);
- Write(Struct.GetBytes(structure));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement