Finalise (hopefully) changes to framework integer types

This commit is contained in:
Alex Harker
2019-06-16 17:32:36 +01:00
parent 831ee2f712
commit 0ff7ff101a
2 changed files with 16 additions and 4 deletions
+13 -3
View File
@@ -187,10 +187,20 @@ public:
unsigned long size() const { return mSize; }
void clear() { mSize = 0; }
static unsigned long alignSize(size_t size) { return (size + (alignment - 1)) & ~(alignment - 1); }
static unsigned long inPlaceSize(size_t size) { return alignSize(sizeof(Serial)) + alignSize(size); }
static unsigned long alignSize(size_t size)
{
return static_cast<unsigned long>((size + (alignment - 1)) & ~(alignment - 1));
}
static Serial *newInPlace(void *ptr, unsigned long size) { return new (ptr) Serial(((BytePointer) ptr) + alignSize(sizeof(Serial)), size); }
static size_t inPlaceSize(unsigned long size)
{
return alignSize(sizeof(Serial)) + alignSize(size);
}
static Serial *newInPlace(void *ptr, unsigned long size)
{
return new (ptr) Serial(((BytePointer) ptr) + alignSize(sizeof(Serial)), size);
}
protected:
@@ -157,10 +157,12 @@ void serialiseGraph(std::vector<FrameLib_Object<FrameLib_Multistream> *>& serial
template <class T>
void addConnection(FrameLib_ObjectDescription& description, std::vector<FrameLib_Object<T> *> serial, typename FrameLib_Object<T>::Connection connect, unsigned long idx)
{
using Connection = FrameLib_ObjectDescription::Connection;
if (connect.mObject)
{
size_t objectIdx = std::find(serial.begin(), serial.end(), connect.mObject) - serial.begin();
description.mConnections.push_back(FrameLib_ObjectDescription::Connection(objectIdx, connect.mIndex, idx));
description.mConnections.push_back(Connection(static_cast<unsigned long>(objectIdx), connect.mIndex, idx));
}
}