Fix for compilation inder Win64: use uintprt_t for pointer arithmetic for alignment purposes

This commit is contained in:
Emil Martinec
2010-08-06 14:27:19 -05:00
parent ab95e09a68
commit 3c3f88006c
2 changed files with 8 additions and 8 deletions

View File

@@ -27,9 +27,9 @@ template <class T> class AlignedBuffer {
public:
T* data ;
AlignedBuffer (int size, int align=16) {
AlignedBuffer (size_t size, size_t align=16) {
real = new T[size+2*align];
data = (T*)((long)real + (align-((long)real)%align));
data = (T*)((uintptr_t)real + (align-((uintptr_t)real)%align));
}
~AlignedBuffer () {

View File

@@ -23,11 +23,11 @@
using namespace rtengine;
Image16::Image16 ()
: r (NULL), g (NULL), b (NULL), data (NULL), unaligned (NULL) {
: unaligned (NULL), data (NULL), r (NULL), g (NULL), b (NULL){
}
Image16::Image16 (int w, int h)
: width(w), height (h), r (NULL), g (NULL), b (NULL), data (NULL), unaligned (NULL) {
: unaligned (NULL), width(w), height (h), data (NULL), r (NULL), g (NULL), b (NULL) {
allocate (w, h);
}
@@ -55,15 +55,15 @@ void Image16::allocate (int width, int height) {
unaligned = new unsigned char[16 + 3 * lsize * sizeof(short) * height];
memset(unaligned, 0, (16 + 3 * lsize * sizeof(short) * height) * sizeof(unsigned char));
size_t poin = (size_t)unaligned + 16 - (size_t)unaligned % 16;
uintptr_t poin = (uintptr_t)unaligned + 16 - (uintptr_t)unaligned % 16;
data = (unsigned short*) (poin);
rowstride = lsize * sizeof(unsigned short);
planestride = rowstride * height;
size_t redstart = poin + 0*planestride;
size_t greenstart = poin + 1*planestride;
size_t bluestart = poin + 2*planestride;
uintptr_t redstart = poin + 0*planestride;
uintptr_t greenstart = poin + 1*planestride;
uintptr_t bluestart = poin + 2*planestride;
r = new unsigned short*[height];
g = new unsigned short*[height];