Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #142784

Re: memcpy or assign data to uint64 on little endian(linux) system

From Ike Naar <ike@iceland.freeshell.org>
Newsgroups comp.lang.c
Subject Re: memcpy or assign data to uint64 on little endian(linux) system
Date 2019-04-03 16:10 +0000
Organization A noiseless patient Spider
Message-ID <slrn3orcqa9mnj.mo9.ike@iceland.freeshell.org> (permalink)
References <3b06fd96-348b-423c-af57-e44e1f79b40c@googlegroups.com>

Show all headers | View raw


On 2019-04-03, WalkeR Park <walker.ykpark@gmail.com> wrote:
> Hi,
> I'm just porting some source that is written from HP-UX to the linux.
> AKA, HP is Big-Endian and liunx is Little-Endian.
>
> In source of HP, threa are many memcpy, and Assign Data Source...
> Porting is OK, but In that case "memcpy or assign data to uint64",  
> Data is stored reversely.
>
> ex)
>=================================================
>         uint64 a;
>         char b[8] = {0x38, 0x12, 0x12, 0x12, 0x81, 0x28, 0x28, 0x28};

Perhaps you want to change that into

          unsigned char b[8] = {0x38, 0x12, 0x12, 0x12, 0x81, 0x28, 0x28, 0x28};

because, on a platform where char is signed, e.g. 0x81 will not fit.

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

memcpy or assign data to uint64 on little endian(linux) system WalkeR Park <walker.ykpark@gmail.com> - 2019-04-02 18:14 -0700
  Re: memcpy or assign data to uint64 on little endian(linux) system Geoff <geoff@invalid.invalid> - 2019-04-02 22:49 -0700
    Re: memcpy or assign data to uint64 on little endian(linux) system Ike Naar <ike@iceland.freeshell.org> - 2019-04-03 06:14 +0000
      Re: memcpy or assign data to uint64 on little endian(linux) system Geoff <geoff@invalid.invalid> - 2019-04-02 23:22 -0700
      Re: memcpy or assign data to uint64 on little endian(linux) system Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-04-03 11:07 +0100
        Re: memcpy or assign data to uint64 on little endian(linux) system Jorgen Grahn <grahn+nntp@snipabacken.se> - 2019-04-03 12:56 +0000
          Re: memcpy or assign data to uint64 on little endian(linux) system fir <profesor.fir@gmail.com> - 2019-04-03 06:52 -0700
          Re: memcpy or assign data to uint64 on little endian(linux) system Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-04-03 16:06 +0100
  Re: memcpy or assign data to uint64 on little endian(linux) system fir <profesor.fir@gmail.com> - 2019-04-03 04:03 -0700
    Re: memcpy or assign data to uint64 on little endian(linux) system fir <profesor.fir@gmail.com> - 2019-04-03 04:13 -0700
  Re: memcpy or assign data to uint64 on little endian(linux) system Jorgen Grahn <grahn+nntp@snipabacken.se> - 2019-04-03 12:37 +0000
  Re: memcpy or assign data to uint64 on little endian(linux) system Ike Naar <ike@iceland.freeshell.org> - 2019-04-03 16:10 +0000
    Re: memcpy or assign data to uint64 on little endian(linux) system Keith Thompson <kst-u@mib.org> - 2019-04-03 12:50 -0700

csiph-web