Is there any way to speedup be32enc in C? Here's an example of what I do for uint32_t:
for (int i=0; i < 19; i++) {
be32enc(&endiandata[i], pdata[i]);
}
And the function itself:
static inline void be32enc(void *pp, uint32_t x)
{
uint8_t *p = (uint8_t *)pp;
p[3] = x & 0xff;
p[2] = (x >> 8) & 0xff;
p[1] = (x >> 16) & 0xff;
p[0] = (x >> 24) & 0xff;
}
I've googled hard, but haven't found anything - this topic is not so popular. Target CPU for this would be i3-7350k and I use msvc2017. May use MIT/GPL libs as well.