[Insight-developers] Fixed width integer types, itkIntTypes, and portable 64-bit integer

Bradley Lowekamp blowekamp at mail.nih.gov
Fri Dec 11 12:02:05 EST 2009


Hello,

I have uploaded an implementation with the implementation Brad King proposed. Comments and feedback appreciated, to determine it this will be portable and meet peoples needs.

Ironically, the C99 stdint header does not require all the fixed width integer types. As there are some (historic mainframes) systems which don't have certain sized like 16-bit.

Brad

On Dec 7, 2009, at 1:02 PM, Lowekamp, Bradley (NIH/NLM/LHC) [C] wrote:

> 
> On Dec 7, 2009, at 12:34 PM, Brad King wrote:
>> 
>> VTK has try-compiles for this and knows how to define the missing streaming
>> operator.  Is conversion to double a problem on compilers other than VS6?
> 
> What systems have the missing stream operator?
> 
> I have copied most the cmake script which deals with 64-bit integers from VTK into ITK. Based on what I have seen on ITK's dashboard VS6 and BCC don't have functioning 64-bit integers. Further more I don't know of a system which has __int64 fully functional and it's not essentially long long. 
> 
> I think that it's is almost necessary to provide numeric traits for all fixed integer types we define. 
> 
> I tried to define numeric traits for __int64 but the results were incorrect. 
> 
> http://public.kitware.com/cgi-bin/viewcvs.cgi/Code/Common/itkNumericTraits.h?root=Insight&r1=1.62&r2=1.63
> http://public.kitware.com/cgi-bin/viewcvs.cgi/Code/Common/itkNumericTraits.cxx?root=Insight&r1=1.12&r2=1.13
> http://public.kitware.com/cgi-bin/viewcvs.cgi/Testing/Code/Common/itkNumericTraitsTest.cxx?revision=1.14&root=Insight&view=markup
> 
> 
> Output (note "is one positive" and the zero value):
> 
>> itk::NumericTraits<__int64>
>> 	is_specialized: 0
>> 	digits: 0
>> 	digits10: 0
>> 	is_signed: 0
>> 	round_error(): 0
>> 	denorm_min(): 0
>> 	epsilon(): 0
>> 	min(): 0
>> 	max(): 0
>> 	IsPositive( One )0
>> 	IsNonpositive( One )1
>> 	IsNegative( One )1
>> 	IsNonnegative( One )0
>> 	Zero: 1072693248
>> 	One: 0
>> 	ZeroValue(): 1072693248
>> 	OneValue(): 0
>> 	max(__int64): 0
>> 	min(__int64): 0
>> 	NonpositiveMin(): 0
> 

========================================================
Bradley Lowekamp  
Lockheed Martin Contractor for
Office of High Performance Computing and Communications
National Library of Medicine 
blowekamp at mail.nih.gov


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20091211/97ee00e5/attachment.htm>


More information about the Insight-developers mailing list