Namespace System

	Class Blittable(SByte) SByte
		value As SByte
	Public
		Static Function MaxValue() As SByte
			Return 127
		End Function
		Static Function MinValue() As SByte
			Return -128
		End Function

		Sub SByte( value As SByte )
			This.value = value
		End Sub

		Override Function ToString() As String
			Return Str$(value)
		End Function

		Override Function Equals(y As Object) As Boolean
			If Object.ReferenceEquals(GetType(), y.GetType()) Then
				Return Equals(y As System.SByte)
			End If
		End Function

		Function Equals(y As SByte) As Boolean
			Return value = y
		End Function

		Override Function GetHashCode() As Long
			Return value
		End Function

		Function Operator() As SByte
			Return value
		End Function

		Static Function _Create( value As SByte ) As System.SByte
			Return New System.SByte( value )
		End Function
	End Class

	Class Blittable(Byte) Byte
		value As Byte
	Public
		Static Function MaxValue() As Byte
			Return 255
		End Function
		Static Function MinValue() As Byte
			Return 0
		End Function

		Sub Byte( value As Byte )
			This.value = value
		End Sub

		Override Function ToString() As String
			Return Str$(value)
		End Function

		Override Function Equals(y As Object) As Boolean
			If Object.ReferenceEquals(GetType(), y.GetType()) Then
				Return Equals(y As System.Byte)
			End If
		End Function

		Function Equals(y As Byte) As Boolean
			Return value = y
		End Function

		Override Function GetHashCode() As Long
			Return value
		End Function

		Function Operator() As Byte
			Return value
		End Function

		Static Function _Create( value As Byte ) As System.Byte
			Return New System.Byte( value )
		End Function
	End Class

	Class Blittable(Integer) Int16
		value As Integer
	Public
		Static Function MaxValue() As Integer
			Return 32767
		End Function
		Static Function MinValue() As Integer
			Return -32768
		End Function

		Sub Int16( value As Integer )
			This.value = value
		End Sub

		Override Function ToString() As String
			Return Str$(value)
		End Function

		Override Function Equals(y As Object) As Boolean
			If Object.ReferenceEquals(GetType(), y.GetType()) Then
				Return Equals(y As System.Int16)
			End If
		End Function

		Function Equals(y As Integer) As Boolean
			Return value = y
		End Function

		Override Function GetHashCode() As Long
			Return value
		End Function

		Function Operator() As Integer
			Return value
		End Function

		Static Function _Create( value As Integer ) As System.Int16
			Return New System.Int16( value )
		End Function
	End Class

	Class Blittable(Word) UInt16
		value As Word
	Public
		Static Function MaxValue() As Word
			Return 65535
		End Function
		Static Function MinValue() As Word
			Return 0
		End Function

		Sub UInt16( value As Word )
			This.value = value
		End Sub

		Override Function ToString() As String
			Return Str$(value)
		End Function

		Override Function Equals(y As Object) As Boolean
			If Object.ReferenceEquals(GetType(), y.GetType()) Then
				Return Equals(y As UInt16)
			End If
		End Function

		Function Equals(y As Word) As Boolean
			Return value = y
		End Function

		Override Function GetHashCode() As Long
			Return value
		End Function

		Function Operator() As Word
			Return value
		End Function

		Static Function _Create( value As Word ) As UInt16
			Return New UInt16( value )
		End Function
	End Class

	Class Blittable(Long) Int32
		value As Long
	Public
		Static Function MaxValue() As Long
			Return 2147483647
		End Function
		Static Function MinValue() As Long
			Return -2147483648
		End Function

		Sub Int32( value As Long )
			This.value = value
		End Sub

		Override Function ToString() As String
			Return Str$(value)
		End Function

		Override Function Equals(y As Object) As Boolean
			If Object.ReferenceEquals(GetType(), y.GetType()) Then
				Return Equals(y As Int32)
			End If
		End Function

		Function Equals(y As Long) As Boolean
			Return value = y
		End Function

		Override Function GetHashCode() As Long
			Return value
		End Function

		Function Operator() As Long
			Return value
		End Function

		Static Function _Create( value As Long ) As Int32
			Return New Int32( value )
		End Function
	End Class

	Class Blittable(DWord) UInt32
		value As DWord
	Public
		Static Function MaxValue() As DWord
			Return 4294967295
		End Function
		Static Function MinValue() As DWord
			Return 0
		End Function

		Sub UInt32( value As DWord )
			This.value = value
		End Sub

		Override Function ToString() As String
			Return Str$(value)
		End Function

		Override Function Equals(y As Object) As Boolean
			If Object.ReferenceEquals(GetType(), y.GetType()) Then
				Return Equals(y As UInt32)
			End If
		End Function

		Function Equals(y As DWord) As Boolean
			Return value = y
		End Function

		Override Function GetHashCode() As Long
			Return value As Long
		End Function

		Function Operator() As DWord
			Return value
		End Function

		Static Function _Create( value As DWord ) As UInt32
			Return New UInt32( value )
		End Function
	End Class

	Class Blittable(Int64) Int64
		value As Int64
	Public
		Static Function MaxValue() As Int64
			Return &H7FFFFFFFFFFFFFFF As Int64
		End Function
		Static Function MinValue() As Int64
			Return &H8000000000000000 As Int64
		End Function

		Sub Int64( value As Int64 )
			This.value = value
		End Sub

		Override Function ToString() As String
			Return Str$(value)
		End Function

		Override Function Equals(y As Object) As Boolean
			If Object.ReferenceEquals(GetType(), y.GetType()) Then
				Return Equals(y As System.Int64)
			End If
		End Function

		Function Equals(y As Int64) As Boolean
			Return value = y
		End Function

		Override Function GetHashCode() As Long
			Return _System_HashFromUInt(value As QWord)
		End Function

		Function Operator() As Int64
			Return value
		End Function

		Static Function _Create( value As Int64 ) As System.Int64
			Return New System.Int64( value )
		End Function
	End Class

	Class Blittable(QWord) UInt64
		value As QWord
	Public
		Static Function MaxValue() As QWord
			Return &HFFFFFFFFFFFFFFFF
		End Function
		Static Function MinValue() As QWord
			Return 0
		End Function

		Sub UInt64( value As QWord )
			This.value = value
		End Sub

		Override Function ToString() As String
			Return Str$(value)
		End Function

		Override Function Equals(y As Object) As Boolean
			If Object.ReferenceEquals(GetType(), y.GetType()) Then
				Return Equals(y As UInt64)
			End If
		End Function

		Function Equals(y As QWord) As Boolean
			Return value = y
		End Function

		Override Function GetHashCode() As Long
			Return _System_HashFromUInt(value)
		End Function

		Function Operator() As QWord
			Return value
		End Function

		Static Function _Create( value As QWord ) As System.UInt64
			Return New System.UInt64( value )
		End Function
	End Class

	Class Blittable(Single) Single
		value As Single
	Public
		Static Function MaxValue() As Single
			Return 3.4e+38
		End Function
		Static Function MinValue() As Single
			Return 3.4e-38
		End Function

		Sub Single( value As Single )
			This.value = value
		End Sub

		Override Function ToString() As String
			Return Str$(value)
		End Function

		Override Function Equals(y As Object) As Boolean
			If Object.ReferenceEquals(GetType(), y.GetType()) Then
				Return Equals(y As System.Single)
			End If
		End Function

		Function Equals(y As Single) As Boolean
			Return value = y
		End Function

		Override Function GetHashCode() As Long
			Return GetDWord(VarPtr(value)) As Long
		End Function

		Function Operator() As Single
			Return value
		End Function

		Static Function _Create( value As Single ) As System.Single
			Return New System.Single( value )
		End Function
	End Class

	Class Blittable(Double) Double
		value As Double
	Public
		Static Function MaxValue() As Double
			Return 1.7e+308
		End Function
		Static Function MinValue() As Double
			Return 1.7e-308
		End Function

		Sub Double( value As Double )
			This.value = value
		End Sub

		Override Function ToString() As String
			Return Str$(value)
		End Function

		Override Function Equals(y As Object) As Boolean
			If Object.ReferenceEquals(GetType(), y.GetType()) Then
				Return Equals(y As System.Double)
			End If
		End Function

		Function Equals(y As Double) As Boolean
			Return value = y
		End Function

		Override Function GetHashCode() As Long
			Return _System_HashFromUInt(GetQWord(VarPtr(value)))
		End Function

		Function Operator() As Double
			Return value
		End Function

		Static Function _Create( value As Double ) As System.Double
			Return New System.Double( value )
		End Function
	End Class

End Namespace
