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

#include <stdint.h>
#include <string.h>
#include <skalibs/uint32.h>

void uint32_reverse (char *s, size_t n)
{
  while (n--)
  {
    uint32_t x ;
    memcpy(&x, s, sizeof(uint32_t)) ;
    x = uint32_bswap(x) ;
    memcpy(s, &x, sizeof(uint32_t)) ;
    s += sizeof(uint32_t) ;
  }
}