From 3c3f88006ca95b8ea98c17404af8eea5385c3924 Mon Sep 17 00:00:00 2001 From: Emil Martinec Date: Fri, 6 Aug 2010 14:27:19 -0500 Subject: [PATCH] Fix for compilation inder Win64: use uintprt_t for pointer arithmetic for alignment purposes --- rtengine/alignedbuffer.h | 4 ++-- rtengine/image16.cc | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/rtengine/alignedbuffer.h b/rtengine/alignedbuffer.h index 360507b42..33a4cdaa1 100644 --- a/rtengine/alignedbuffer.h +++ b/rtengine/alignedbuffer.h @@ -27,9 +27,9 @@ template 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 () { diff --git a/rtengine/image16.cc b/rtengine/image16.cc index 5b02172a5..1afe0e258 100644 --- a/rtengine/image16.cc +++ b/rtengine/image16.cc @@ -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];