Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for issue #39. Untested on real big-endian hardware. #40

Closed
wants to merge 1 commit into from
Closed

Fix for issue #39. Untested on real big-endian hardware. #40

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Aug 7, 2015

Tiny bug fix to be confident with the contribution process. Hoping <3 will follow :)
WARNING : this patch is wrong :-/

@smortex
Copy link
Contributor

smortex commented Aug 10, 2015

The le24toh() function is endianess agnostic by design… Verified on both little-endian (amd64) and big-endian (sparc64) hardware with the following snippet of code:

#include <sys/types.h>

#include <stdio.h>
#include <stdlib.h>

static int32_t
le24toh (uint8_t data[3])
{
    return (data[2] << 16) | (data[1] << 8) | data[0];
}

int
main (void)
{
    uint8_t buffer[] = {
        0x01, 0x23, 0x45
    };

    int32_t val;

    val = le24toh (buffer);

    printf ("0x%06x\n", val);

    exit (EXIT_SUCCESS);
}

On both systems, the output is 0x452301 as expected.

@smortex
Copy link
Contributor

smortex commented Aug 10, 2015

Otherwise, the pull-request submission process seems okay :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant