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

#include <sys/types.h>
#include <skalibs/uint64.h>

void uint64_reverse (char *s, size_t n)
{
  while (n--)
  {
    char c = s[0] ; s[0] = s[7] ; s[7] = c ;
    c = s[1] ; s[1] = s[6] ; s[6] = c ;
    c = s[2] ; s[2] = s[5] ; s[5] = c ;
    c = s[3] ; s[3] = s[4] ; s[4] = c ;
    s += 8 ;
  }
}