-
Notifications
You must be signed in to change notification settings - Fork 23
/
STByteArray.h
51 lines (38 loc) · 1.31 KB
/
STByteArray.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/******************************************************************************
File: STByteArray.h
Description:
VM representation of Smalltalk ByteArray class.
N.B. The representation of this class must NOT be changed.
******************************************************************************/
#pragma once
#include "STCollection.h"
// Turn off warning about zero length arrays
#pragma warning ( disable : 4200)
// Declare forward references
namespace ST { class ByteArray; }
typedef TOTE<ST::ByteArray> ByteArrayOTE;
namespace ST
{
class ByteArray : public ArrayedCollection
{
public:
uint8_t m_elements[];
static ByteArrayOTE* New(MWORD size);
static ByteArrayOTE* New(MWORD size, const void* pBytes);
static ByteArrayOTE* NewWithRef(MWORD size, const void* pBytes);
};
inline ByteArrayOTE* ByteArray::New(MWORD size)
{
return reinterpret_cast<ByteArrayOTE*>(ObjectMemory::newByteObject<false, true>(Pointers.ClassByteArray, size));
}
inline ByteArrayOTE* ByteArray::New(MWORD size, const void* pBytes)
{
return reinterpret_cast<ByteArrayOTE*>(ObjectMemory::newByteObject(Pointers.ClassByteArray, size, pBytes));
}
inline ByteArrayOTE* ByteArray::NewWithRef(MWORD size, const void* pBytes)
{
ByteArrayOTE* byteArray = New(size, pBytes);
byteArray->m_count = 1;
return byteArray;
}
}