On recent realization: <br><br> "size_t" is unsigned :-/<br><br>and we need the OffsetValueType to be signed,<br>since we use it to compute differences...<br><br>It seems that what we need is the type<br>
<br> "ptrdiff_t"<br><br>which is supposed to represent the differences<br>between two pointers, and therefore should be<br>capable of measuring distances between any<br>two locations in memory.<br>
<br>I'm now rerunning the Experimental with <br>"ptrdiff_t" instead of "size_t".<br><font color="#888888"><br><br> Luis<br></font><br>------------------------------------------------------------------------------------------------------<br>
<div class="gmail_quote">On Fri, Jul 10, 2009 at 12:30 PM, Luis Ibanez <span dir="ltr"><<a href="mailto:luis.ibanez@kitware.com">luis.ibanez@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Kana,<br><br>Thanks a lot for looking into this and sharing your findings.<br><br>I just confirmed that in Windows 64bits, the "long" type is<br>only 4 bytes.<br><br>Here is the program I used:<br><br>#include <iostream><br>
#include "itkOffset.h"<br>#include "itkNumericTraits.h"<div class="im"><br><br>int main()<br>{<br> unsigned long tt;<br> std::cout << "size = " << sizeof(tt) << std::endl;<br>
tt = -1;<br>
std::cout << "tt = " << tt << std::endl;<br><br></div> typedef itk::Offset<3> OffsetType;<br> typedef OffsetType::OffsetValueType OffsetValueType;<br><br> OffsetValueType offsetValue;<br>
<br> std::cout << "sizeof(offsetValue) = " << sizeof( offsetValue ) << std::endl;<br><br> offsetValue = itk::NumericTraits< OffsetValueType >::max();<br><br> std::cout << "OffsetValueType max() = " << offsetValue << std::endl;<br>
<br> return EXIT_SUCCESS;<br>}<br><br><br>with this CMakeLists.txt file<br><br><br>CMAKE_MINIMUM_REQUIRED(VERSION 2.4)<br>IF(COMMAND CMAKE_POLICY)<br> CMAKE_POLICY(SET CMP0003 NEW)<br>ENDIF(COMMAND CMAKE_POLICY)<br><br>
<br>PROJECT(64bitsTest)<br><br>FIND_PACKAGE(ITK REQUIRED)<br>INCLUDE(${ITK_USE_FILE})<br><br>ADD_EXECUTABLE(typesTest typesTest.cxx )<br><br>TARGET_LINK_LIBRARIES(typesTest ITKCommon)<br><br></blockquote></div><br>