Page 1 of 1

#MaxInteger would be fine

Posted: Fri Dec 28, 2012 2:15 pm
by Michael Vogel
What about a nice companion for #MaxLong?

Even if #MaxInteger is the same like 1<<(#PB_Compiler_Processor<<4-1)-1 for X86 architecture it could be useful.

Re: #MaxInteger would be fine

Posted: Fri Dec 28, 2012 2:17 pm
by eesau
#MaxLong is a Windows api constant, not PB. That being said, equivalents in PB could be useful.

Re: #MaxInteger would be fine

Posted: Fri Dec 28, 2012 2:22 pm
by Little John
We can easily use something like this:

Code: Select all

;-- range of *signed* 32-bit integers
#MIN_32BIT_S = -$80000000              ; = -Pow(2,31)
#MAX_32BIT_S =  $7FFFFFFF              ; =  Pow(2,31)-1

;-- range of *unsigned* 32-bit integers
#MIN_32BIT_U =  0
#MAX_32BIT_U =  $FFFFFFFF              ; =  Pow(2,32)-1

;-- range of *signed* 64-bit integers
#MIN_64BIT_S = -$8000000000000000      ; = -Pow(2,63)
#MAX_64BIT_S =  $7FFFFFFFFFFFFFFF      ; =  Pow(2,63)-1
Regards, Little John

Re: #MaxInteger would be fine

Posted: Fri Dec 28, 2012 2:23 pm
by STARGĂ…TE

Code: Select all

#PB_MinByte    = -$80
#PB_MaxByte    =  $7F
#PB_MinAscii   =  $00
#PB_MaxAscii   =  $FF

#PB_MinWord    = -$8000
#PB_MaxWord    =  $7FFF
#PB_MinUnicode =  $0000
#PB_MaxUnicode =  $FFFF

CompilerIf SizeOf(Character) = SizeOf(Ascii)
  #PB_MinCharacter = #PB_MinAscii
  #PB_MaxCharacter = #PB_MaxAscii
CompilerElse
  #PB_MinCharacter = #PB_MinUnicode
  #PB_MaxCharacter = #PB_MaxUnicode 
CompilerEndIf

#PB_MinLong = -$80000000
#PB_MaxLong =  $7FFFFFFF
#PB_MinQuad = -$8000000000000000
#PB_MaxQuad =  $7FFFFFFFFFFFFFFF

CompilerIf SizeOf(Integer) = SizeOf(Long)
  #PB_MinInteger = #PB_MinLong
  #PB_MaxInteger = #PB_MaxLong
CompilerElse
  #PB_MinInteger = #PB_MinQuad
  #PB_MaxInteger = #PB_MaxQuad 
CompilerEndIf