NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: port-arm/46898: t_nat_ipf_exec



 test program:
=============================================================
#include <stdio.h>
#include <stdint.h>

#include <arpa/inet.h>

uint32_t wrapsum(uint32_t);

int sum = 0x00000102;

uint32_t
wrapsum(uint32_t sum)
{
        sum = ~sum & 0xFFFF;
        return htons(sum);
}

int
main(int argc, char *argv[])
{
        uint32_t wsum = wrapsum(sum);

        printf("0x%08x\n", wsum);

        return 0;
}
=============================================================

On i386:
> % gcc -O2 pkt.c -o pkt
> % ./pkt
> 0x0000fdfe

On arm:
> $ gcc -O2 pkt.c -o pkt
> $ ./pkt
> 0x0000ffff


-- 
-----------------------------------------------
                SAITOH Masanobu (msaitoh%execsw.org@localhost
                                 msaitoh%netbsd.org@localhost)


Home | Main Index | Thread Index | Old Index