Commit 598ffd98 authored by Zhukov, Alexander P's avatar Zhukov, Alexander P
Browse files

added byteswap implementation for Mac to work

parent c1be3ccd
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <byteswap.h>
/* #include <byteswap.h> */
#include <sys/time.h>
#include "binary_storage.h"
......
#include <stdint.h>
#if HAVE_BYTESWAP_H
#include <byteswap.h>
#else
#define bswap_16(value) \
((((value) & 0xff) << 8) | ((value) >> 8))
#define bswap_32(value) \
(((uint32_t)bswap_16((uint16_t)((value) & 0xffff)) << 16) | \
(uint32_t)bswap_16((uint16_t)((value) >> 16)))
#define bswap_64(value) \
(((uint64_t)bswap_32((uint32_t)((value) & 0xffffffff)) \
<< 32) | \
(uint64_t)bswap_32((uint32_t)((value) >> 32)))
#endif
typedef struct tagset {
char **data;
size_t num;
......@@ -19,6 +36,3 @@ typedef struct storage {
BinaryStorage bs_open(char* filename);
int write_record(BinaryStorage *bs, char* name, TSTMP timestamp, double value, TAGS *tags);
void bs_close(BinaryStorage *bs);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment