Reverted to different code in support of https://github.com/Unidata/netcdf-c/issues/344

This commit is contained in:
Ward Fisher 2017-01-04 15:40:19 -07:00
parent 59618c481b
commit 2f3b894bec
2 changed files with 12 additions and 12 deletions

View File

@ -10,6 +10,12 @@
#include "ncio.h"
#include "fbits.h"
#ifndef HAVE_STDINT_H
#include "pstdint.h"
#else
#include <stdint.h>
#endif /* HAVE_STDINT_H */
/*
* An external data representation interface.

View File

@ -190,19 +190,13 @@ swapn2b(void *dst, const void *src, size_t nn)
void
swap4b(void *dst, const void *src)
{
unsigned int *op = dst;
const char *ip = src;
unsigned int tempIn;
unsigned int tempOut;
uint32_t* op32 = (uint32_t*)(dst);
const uint32_t* ip32 = (const uint32_t*)(src);
tempIn = *(unsigned int *)(ip+0);
tempOut =
( tempIn << 24) |
((tempIn & 0x0000ff00) << 8) |
((tempIn & 0x00ff0000) >> 8) |
( tempIn >> 24);
*op = *(&tempOut);
*op32 = (((*ip32) ) << 24) |
(((*ip32) & 0x0000ff00u) << 8) |
(((*ip32) & 0x00ff0000u) >> 8) |
(((*ip32) ) >> 24);
}
# endif /* !vax */