Sha256: 578b2902fc2e7480a1c55c537cae130b9353b163c943a74fe4a4eda0a8ff1e45

Contents?: true

Size: 1.15 KB

Versions: 20

Compression:

Stored size: 1.15 KB

Contents

#include "common.h"

uint32 load32_bigendian(const unsigned char *x)
{
  return
      (uint32) (x[3]) \
  | (((uint32) (x[2])) << 8) \
  | (((uint32) (x[1])) << 16) \
  | (((uint32) (x[0])) << 24)
  ;
}

void store32_bigendian(unsigned char *x,uint32 u)
{
  x[3] = u; u >>= 8;
  x[2] = u; u >>= 8;
  x[1] = u; u >>= 8;
  x[0] = u;
}

uint32 load32_littleendian(const unsigned char *x)
{
  return
      (uint32) (x[0]) \
  | (((uint32) (x[1])) << 8) \
  | (((uint32) (x[2])) << 16) \
  | (((uint32) (x[3])) << 24)
  ;
}

void store32_littleendian(unsigned char *x,uint32 u)
{
  x[0] = u; u >>= 8;
  x[1] = u; u >>= 8;
  x[2] = u; u >>= 8;
  x[3] = u;
}


uint64 load64_littleendian(const unsigned char *x)
{
  return
      (uint64) (x[0]) \
  | (((uint64) (x[1])) << 8) \
  | (((uint64) (x[2])) << 16) \
  | (((uint64) (x[3])) << 24)
  | (((uint64) (x[4])) << 32)
  | (((uint64) (x[5])) << 40)
  | (((uint64) (x[6])) << 48)
  | (((uint64) (x[7])) << 56)
  ;
}

void store64_littleendian(unsigned char *x,uint64 u)
{
  x[0] = u; u >>= 8;
  x[1] = u; u >>= 8;
  x[2] = u; u >>= 8;
  x[3] = u; u >>= 8;
  x[4] = u; u >>= 8;
  x[5] = u; u >>= 8;
  x[6] = u; u >>= 8;
  x[7] = u;
}

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
rbnacl-libsodium-1.0.8 vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/common_aes128ctr.c
rbnacl-libsodium-1.0.7 vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/common_aes128ctr.c
rbnacl-libsodium-1.0.6 vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/common_aes128ctr.c
rbnacl-libsodium-1.0.5 vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/common_aes128ctr.c
rbnacl-libsodium-1.0.4 vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/common_aes128ctr.c
rbnacl-libsodium-1.0.3 vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/common_aes128ctr.c
rbnacl-libsodium-1.0.2 vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/common_aes128ctr.c
rbnacl-libsodium-1.0.1 vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/common_aes128ctr.c
rbnacl-libsodium-1.0.0 vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/common_aes128ctr.c
rbnacl-libsodium-0.7.0 vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/common_aes128ctr.c
rbnacl-libsodium-0.6.1 vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/common_aes128ctr.c
rbnacl-libsodium-0.6.0 vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/common_aes128ctr.c
rbnacl-libsodium-0.5.0.1 vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/common_aes128ctr.c
rbnacl-libsodium-0.5.0.1.pre vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/common_aes128ctr.c
rbnacl-libsodium-0.5.0 vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/common_aes128ctr.c
rbnacl-libsodium-0.4.5 vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/common_aes128ctr.c
rbnacl-libsodium-0.4.5a vendor/libsodium/src/libsodium/crypto_stream/aes128ctr/portable/common_aes128ctr.c
ruby_nacl-0.1.2 ext/ruby_nacl/NaCl/crypto_stream/aes128ctr/portable/common.c
ruby_nacl-0.1.1 ext/ruby_nacl/NaCl/crypto_stream/aes128ctr/portable/common.c
ruby_nacl-0.1.0 ext/ruby_nacl/NaCl/crypto_stream/aes128ctr/portable/common.c