Skip to content
IntFromBytesLE

IntFromBytesLE

IntFromBytesLE

Description

Create an integer from little-endian bytes.

Parameters

Name Direction Description
bytes in Source byte buffer
len in Number of bytes to read

Usage example (from documentation)

  Int value = IntFromBytesLE(buffer, buffer_len);

Returns

Integer decoded from the byte sequence.

Usage example (Cross-references)

Usage examples (Cross-references)
    }
    
    Int IntFromBytesLE(const u8 *bytes, u64 len) {
        if (!bytes && len != 0) {
            LOG_FATAL("bytes is NULL");
        u8  bytes[] = {0x34, 0x12, 0xEF, 0xCD};
        u8  out[4]  = {0};
        Int value   = IntFromBytesLE(bytes, sizeof(bytes));
        u64 written = IntToBytesLE(&value, out, sizeof(out));
        Str text    = IntToHexStr(&value);
    
    bool test_int_from_bytes_le_null(void) {
        WriteFmt("Testing IntFromBytesLE NULL handling\n");
    
        IntFromBytesLE(NULL, 1);
        WriteFmt("Testing IntFromBytesLE NULL handling\n");
    
        IntFromBytesLE(NULL, 1);
        return false;
    }
Last updated on