Same as a C uint32_t
core :: UInt32 :: code_point
The character which code point (unicode-wise) isself
core :: UInt32 :: from_utf16_surr
Returns the code_point from a utf16 surrogate paircore :: Object :: class_factory
Implementation used byget_class
to create the specific class.
core :: UInt32 :: code_point
The character which code point (unicode-wise) isself
core :: Comparable :: defaultinit
core :: Numeric :: defaultinit
core :: Discrete :: defaultinit
core :: Object :: defaultinit
core :: UInt32 :: from_utf16_surr
Returns the code_point from a utf16 surrogate paircore :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
core :: Object :: output_class_name
Display class name on stdout (debug only).
# Native 32-bit unsigned integer.
# Same as a C `uint32_t`
universal UInt32
super Discrete
super Numeric
redef type OTHER: UInt32
redef fun successor(i) do return self + i.to_u32
redef fun predecessor(i) do return self - i.to_u32
redef fun object_id is intern
redef fun hash do return self.to_i
redef fun ==(i) is intern
redef fun !=(i) is intern
redef fun output is intern
redef fun <=(i) is intern
redef fun <(i) is intern
redef fun >=(i) is intern
redef fun >(i) is intern
redef fun +(i) is intern
# assert -1u32 == 0xFFFFFFFFu32
# assert -0u32 == 0x00u32
redef fun - is intern
redef fun -(i) is intern
redef fun *(i) is intern
redef fun /(i) is intern
# Modulo of `self` with `i`.
#
# Returns the remainder of division of `self` by `i`.
#
# assert 5u32 % 2u32 == 1u32
# assert 10u32 % 2u32 == 0u32
fun %(i: UInt32): UInt32 is intern
redef fun zero do return 0.to_u32
redef fun value_of(val) do return val.to_u32
# `i` bits shift to the left
#
# assert 5u32 << 1 == 10u32
fun <<(i: Int): UInt32 is intern
# `i` bits shift to the right
#
# assert 5u32 >> 1 == 2u32
fun >>(i: Int): UInt32 is intern
redef fun to_i is intern
redef fun to_f is intern
redef fun to_b is intern
redef fun to_i8 is intern
redef fun to_i16 is intern
redef fun to_u16 is intern
redef fun to_i32 is intern
redef fun to_u32 do return self
redef fun distance(i) do return (self - i).to_i
redef fun <=>(other)
do
if self < other then
return -1
else if other < self then
return 1
else
return 0
end
end
redef fun is_between(c, d)
do
if self < c or d < self then
return false
else
return true
end
end
redef fun max(other)
do
if self < other then
return other
else
return self
end
end
redef fun min(c)
do
if c < self then
return c
else
return self
end
end
# Returns the result of a binary AND operation on `self` and `i`
#
# assert 0x10u32 & 0x01u32 == 0u32
fun &(i: UInt32): UInt32 is intern
# Returns the result of a binary OR operation on `self` and `i`
#
# assert 0x10u32 | 0x01u32 == 0x11u32
fun |(i: UInt32): UInt32 is intern
# Returns the result of a binary XOR operation on `self` and `i`
#
# assert 0x101u32 ^ 0x110u32 == 0x11u32
fun ^(i: UInt32): UInt32 is intern
# Returns the 1's complement of `self`
#
# assert ~0x2Fu32 == 0xFFFFFFD0u32
fun ~: UInt32 is intern
end
lib/core/fixed_ints.nit:585,1--704,3
redef class UInt32
# Returns the code_point from a utf16 surrogate pair
#
# assert 0xD83DDE02u32.from_utf16_surr == 0x1F602u32
fun from_utf16_surr: UInt32 do
var hi = (self & 0xFFFF0000u32) >> 16
var lo = self & 0xFFFFu32
var cp = 0u32
cp += (hi - 0xD800u32) << 10
cp += lo - 0xDC00u32
cp += 0x10000u32
return cp
end
# The character which code point (unicode-wise) is `self`
#
# assert 65u32.code_point == 'A'
# assert 10u32.code_point == '\n'
# assert 0x220Bu32.code_point == '∋'
fun code_point: Char `{ return self; `}
end
lib/core/text/native.nit:71,1--91,3
redef class UInt32
# C function to calculate the length of the `CString` to receive `self`
private fun to_s_len: Int `{
return snprintf(NULL, 0, "%"PRIu32, self);
`}
# C function to convert a nit Int to a CString (char*)
private fun native_to_s(nstr: CString, strlen: Int) `{
snprintf(nstr, strlen, "%"PRIu32, self);
`}
# Displayable UInt32
#
# assert 1u32.to_s == "1"
# assert (-123u32).to_s == "4294967173"
redef fun to_s do
var nslen = to_s_len
var ns = new CString(nslen + 1)
ns[nslen] = 0
native_to_s(ns, nslen + 1)
return ns.to_s_unsafe(nslen, copy=false)
end
end
lib/core/text/fixed_ints_text.nit:120,1--142,3