#include <stdlib.h>
#include <math.h>
-#include <boost/foreach.hpp>
-
+#include "config.h"
#include "logicsnapshot.h"
-using boost::lock_guard;
-using boost::recursive_mutex;
+using std::lock_guard;
+using std::recursive_mutex;
using std::max;
using std::min;
using std::pair;
LogicSnapshot::~LogicSnapshot()
{
lock_guard<recursive_mutex> lock(_mutex);
- BOOST_FOREACH(MipMapLevel &l, _mip_map)
+ for (MipMapLevel &l : _mip_map)
free(l.data);
}
uint64_t LogicSnapshot::unpack_sample(const uint8_t *ptr) const
{
+#ifdef HAVE_UNALIGNED_LITTLE_ENDIAN_ACCESS
+ return *(uint64_t*)ptr;
+#else
uint64_t value = 0;
switch(_unit_size) {
default:
break;
}
return value;
+#endif
}
void LogicSnapshot::pack_sample(uint8_t *ptr, uint64_t value)
{
+#ifdef HAVE_UNALIGNED_LITTLE_ENDIAN_ACCESS
+ *(uint64_t*)ptr = value;
+#else
switch(_unit_size) {
default:
ptr[7] = value >> 56;
case 0:
break;
}
+#endif
}
void LogicSnapshot::append_payload(
lock_guard<recursive_mutex> lock(_mutex);
const size_t size = (end_sample - start_sample) * _unit_size;
- memcpy(data, (const uint8_t*)_data + start_sample, size);
+ memcpy(data, (const uint8_t*)_data + start_sample * _unit_size, size);
}
void LogicSnapshot::reallocate_mipmap_level(MipMapLevel &m)