Skip to content

Make unsafe handle big endian #4

@patridge

Description

@patridge

[via comment from Stack Overflow question]

The unsafe byte->string variant to handle when BitConverter.IsLittleEndian == false.

Comment indicates that the original CodesInChaos source material handles this situation, which appears true.

if(BitConverter.IsLittleEndian)
    result[i] = ((uint)s[0]) + ((uint)s[1] << 16);
else
    result[i] = ((uint)s[1]) + ((uint)s[0] << 16);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions