Changeset f09b75b in mainline


Ignore:
Timestamp:
2025-04-21T12:24:11Z (4 weeks ago)
Author:
Miroslav Cimerman <mc@…>
Children:
18c3658
Parents:
10291a23
Message:

hr: metadata/foreign/geom: add <sys/endian.h>

Location:
uspace/srv/bd/hr/metadata/foreign/geom
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/bd/hr/metadata/foreign/geom/g_mirror.h

    r10291a23 rf09b75b  
    4747#define bcopy(src, dst, len) memcpy(dst, src, len)
    4848
    49 /* copied here from <sys/endian.h> */
    50 static __inline void
    51 le32enc(void *pp, uint32_t u)
    52 {
    53         uint8_t *p = (uint8_t *)pp;
    54 
    55         p[0] = u & 0xff;
    56         p[1] = (u >> 8) & 0xff;
    57         p[2] = (u >> 16) & 0xff;
    58         p[3] = (u >> 24) & 0xff;
    59 }
    60 
    61 static __inline void
    62 le64enc(void *pp, uint64_t u)
    63 {
    64         uint8_t *p = (uint8_t *)pp;
    65 
    66         le32enc(p, (uint32_t)(u & 0xffffffffU));
    67         le32enc(p + 4, (uint32_t)(u >> 32));
    68 }
    69 
    70 static __inline uint32_t
    71 le32dec(const void *pp)
    72 {
    73         uint8_t const *p = (uint8_t const *)pp;
    74 
    75         return (((unsigned)p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0]);
    76 }
    77 
    78 static __inline uint64_t
    79 le64dec(const void *pp)
    80 {
    81         uint8_t const *p = (uint8_t const *)pp;
    82 
    83         return (((uint64_t)le32dec(p + 4) << 32) | le32dec(p));
    84 }
     49/* needed FreeBSD <sys/endian.h> header */
     50#include "sys_endian.h"
    8551
    8652/* here continues the stripped down original header */
Note: See TracChangeset for help on using the changeset viewer.