summaryrefslogtreecommitdiff
path: root/src/libstddjb/uint64_reverse.c
blob: a870b31d98df24180efa55a0e1841e25360ed709 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/* ISC license. */

#include <string.h>
#include <skalibs/uint64.h>

void uint64_reverse (char *s, size_t n)
{
  while (n--)
  {
    uint64_t x ;
    memcpy(&x, s, sizeof(uint64_t)) ;
    x = uint64_bswap(x) ;
    memcpy(s, &x, sizeof(uint64_t)) ;
    s += sizeof(uint64_t) ;
  }
}