diff --git a/NEWS.md b/NEWS.md index 930d9df3905cc..6c2188d9734e3 100644 --- a/NEWS.md +++ b/NEWS.md @@ -23,6 +23,8 @@ New language features Language changes ---------------- + * `Uint` et al. are now spelled `UInt` ([#8905]). + * `String` has been renamed to `AbstractString` ([#8872]). * `None` is deprecated; use `Union()` instead ([#8423]). diff --git a/base/REPL.jl b/base/REPL.jl index 8dc532c013e4b..a0b5d57146813 100644 --- a/base/REPL.jl +++ b/base/REPL.jl @@ -71,13 +71,13 @@ function parse_input_line(s::AbstractString) # s = bytestring(s) # (expr, pos) = parse(s, 1) # (ex, pos) = ccall(:jl_parse_string, Any, - # (Ptr{Uint8},Int32,Int32), + # (Ptr{UInt8},Int32,Int32), # s, int32(pos)-1, 1) # if !is(ex,()) # throw(ParseError("extra input after end of expression")) # end # expr - ccall(:jl_parse_input_line, Any, (Ptr{Uint8},), s) + ccall(:jl_parse_input_line, Any, (Ptr{UInt8},), s) end function start_repl_backend(repl_channel::RemoteRef, response_channel::RemoteRef) @@ -309,7 +309,7 @@ type REPLHistoryProvider <: HistoryProvider end REPLHistoryProvider(mode_mapping) = REPLHistoryProvider(AbstractString[], nothing, 0, -1, IOBuffer(), - nothing, mode_mapping, Uint8[]) + nothing, mode_mapping, UInt8[]) const invalid_history_message = """ Invalid history format. If you have a ~/.julia_history file left over from an older version of Julia, try renaming or deleting it. diff --git a/base/Terminals.jl b/base/Terminals.jl index a8c8fc44947f4..d0a56c7cca152 100644 --- a/base/Terminals.jl +++ b/base/Terminals.jl @@ -40,7 +40,7 @@ abstract TextTerminal <: Base.IO # INTERFACE size(::TextTerminal) = error("Unimplemented") -writepos(t::TextTerminal, x, y, s::Array{Uint8,1}) = error("Unimplemented") +writepos(t::TextTerminal, x, y, s::Array{UInt8,1}) = error("Unimplemented") cmove(t::TextTerminal, x, y) = error("Unimplemented") getX(t::TextTerminal) = error("Unimplemented") getY(t::TextTerminal) = error("Unimplemented") @@ -74,7 +74,7 @@ hascolor(::TextTerminal) = false # Utility Functions function writepos{T}(t::TextTerminal, x, y, b::Array{T}) if isbits(T) - writepos(t, x, y, reinterpret(Uint8, b)) + writepos(t, x, y, reinterpret(UInt8, b)) else cmove(t, x, y) invoke(write, (IO, Array), s, a) @@ -183,14 +183,14 @@ clear_line(t::UnixTerminal) = write(t.out_stream, "\x1b[0G\x1b[0K") #beep(t::UnixTerminal) = write(t.err_stream,"\x7") write{T,N}(t::UnixTerminal, a::Array{T,N}) = write(t.out_stream, a) -write(t::UnixTerminal, p::Ptr{Uint8}) = write(t.out_stream, p) -write(t::UnixTerminal, p::Ptr{Uint8}, x::Integer) = write(t.out_stream, p, x) -write(t::UnixTerminal, x::Uint8) = write(t.out_stream, x) +write(t::UnixTerminal, p::Ptr{UInt8}) = write(t.out_stream, p) +write(t::UnixTerminal, p::Ptr{UInt8}, x::Integer) = write(t.out_stream, p, x) +write(t::UnixTerminal, x::UInt8) = write(t.out_stream, x) read{T,N}(t::UnixTerminal, x::Array{T,N}) = read(t.in_stream, x) readuntil(t::UnixTerminal, s::AbstractString) = readuntil(t.in_stream, s) readuntil(t::UnixTerminal, c::Char) = readuntil(t.in_stream, c) readuntil(t::UnixTerminal, s) = readuntil(t.in_stream, s) -read(t::UnixTerminal, ::Type{Uint8}) = read(t.in_stream, Uint8) +read(t::UnixTerminal, ::Type{UInt8}) = read(t.in_stream, UInt8) start_reading(t::UnixTerminal) = start_reading(t.in_stream) stop_reading(t::UnixTerminal) = stop_reading(t.in_stream) diff --git a/base/abstractarray.jl b/base/abstractarray.jl index a249fa1f27ea7..64f7966985184 100644 --- a/base/abstractarray.jl +++ b/base/abstractarray.jl @@ -255,12 +255,12 @@ for (f,t) in ((:char, Char), (:int32, Int32), (:int64, Int64), (:int128, Int128), - (:uint, Uint), - (:uint8, Uint8), - (:uint16, Uint16), - (:uint32, Uint32), - (:uint64, Uint64), - (:uint128,Uint128)) + (:uint, UInt), + (:uint8, UInt8), + (:uint16, UInt16), + (:uint32, UInt32), + (:uint64, UInt64), + (:uint128,UInt128)) @eval begin ($f)(x::AbstractArray{$t}) = x ($f)(x::AbstractArray{$t}) = x diff --git a/base/array.jl b/base/array.jl index 49e30d5136379..fb6ec5287888b 100644 --- a/base/array.jl +++ b/base/array.jl @@ -31,7 +31,7 @@ isassigned(a::Array, i::Int...) = isdefined(a, i...) ## copy ## function unsafe_copy!{T}(dest::Ptr{T}, src::Ptr{T}, N) - ccall(:memmove, Ptr{Void}, (Ptr{Void}, Ptr{Void}, Uint), + ccall(:memmove, Ptr{Void}, (Ptr{Void}, Ptr{Void}, UInt), dest, src, N*sizeof(T)) return dest end @@ -150,7 +150,7 @@ function getindex{T<:Union(Char,Number)}(::Type{T}, r1::Range, rs::Range...) return a end -function fill!{T<:Union(Int8,Uint8)}(a::Array{T}, x::Integer) +function fill!{T<:Union(Int8,UInt8)}(a::Array{T}, x::Integer) ccall(:memset, Ptr{Void}, (Ptr{Void}, Int32, Csize_t), a, x, length(a)) return a end @@ -402,7 +402,7 @@ function _growat!(a::Vector, i::Integer, delta::Integer) end function _growat_beg!(a::Vector, i::Integer, delta::Integer) - ccall(:jl_array_grow_beg, Void, (Any, Uint), a, delta) + ccall(:jl_array_grow_beg, Void, (Any, UInt), a, delta) if i > 1 ccall(:memmove, Ptr{Void}, (Ptr{Void}, Ptr{Void}, Csize_t), pointer(a, 1), pointer(a, 1+delta), (i-1)*elsize(a)) @@ -411,7 +411,7 @@ function _growat_beg!(a::Vector, i::Integer, delta::Integer) end function _growat_end!(a::Vector, i::Integer, delta::Integer) - ccall(:jl_array_grow_end, Void, (Any, Uint), a, delta) + ccall(:jl_array_grow_end, Void, (Any, UInt), a, delta) n = length(a) if n >= i+delta ccall(:memmove, Ptr{Void}, (Ptr{Void}, Ptr{Void}, Csize_t), @@ -438,7 +438,7 @@ function _deleteat_beg!(a::Vector, i::Integer, delta::Integer) ccall(:memmove, Ptr{Void}, (Ptr{Void}, Ptr{Void}, Csize_t), pointer(a, 1+delta), pointer(a, 1), (i-1)*elsize(a)) end - ccall(:jl_array_del_beg, Void, (Any, Uint), a, delta) + ccall(:jl_array_del_beg, Void, (Any, UInt), a, delta) return a end @@ -448,7 +448,7 @@ function _deleteat_end!(a::Vector, i::Integer, delta::Integer) ccall(:memmove, Ptr{Void}, (Ptr{Void}, Ptr{Void}, Csize_t), pointer(a, i), pointer(a, i+delta), (n-i-delta+1)*elsize(a)) end - ccall(:jl_array_del_end, Void, (Any, Uint), a, delta) + ccall(:jl_array_del_end, Void, (Any, UInt), a, delta) return a end @@ -457,27 +457,27 @@ end function push!{T}(a::Array{T,1}, item) # convert first so we don't grow the array if the assignment won't work item = convert(T, item) - ccall(:jl_array_grow_end, Void, (Any, Uint), a, 1) + ccall(:jl_array_grow_end, Void, (Any, UInt), a, 1) a[end] = item return a end function push!(a::Array{Any,1}, item::ANY) - ccall(:jl_array_grow_end, Void, (Any, Uint), a, 1) + ccall(:jl_array_grow_end, Void, (Any, UInt), a, 1) arrayset(a, item, length(a)) return a end function append!{T}(a::Array{T,1}, items::AbstractVector) n = length(items) - ccall(:jl_array_grow_end, Void, (Any, Uint), a, n) + ccall(:jl_array_grow_end, Void, (Any, UInt), a, n) copy!(a, length(a)-n+1, items, 1, n) return a end function prepend!{T}(a::Array{T,1}, items::AbstractVector) n = length(items) - ccall(:jl_array_grow_beg, Void, (Any, Uint), a, n) + ccall(:jl_array_grow_beg, Void, (Any, UInt), a, n) if a === items copy!(a, 1, items, n+1, n) else @@ -489,18 +489,18 @@ end function resize!(a::Vector, nl::Integer) l = length(a) if nl > l - ccall(:jl_array_grow_end, Void, (Any, Uint), a, nl-l) + ccall(:jl_array_grow_end, Void, (Any, UInt), a, nl-l) else if nl < 0 throw(BoundsError()) end - ccall(:jl_array_del_end, Void, (Any, Uint), a, l-nl) + ccall(:jl_array_del_end, Void, (Any, UInt), a, l-nl) end return a end function sizehint(a::Vector, sz::Integer) - ccall(:jl_array_sizehint, Void, (Any, Uint), a, sz) + ccall(:jl_array_sizehint, Void, (Any, UInt), a, sz) a end @@ -509,13 +509,13 @@ function pop!(a::Vector) error("array must be non-empty") end item = a[end] - ccall(:jl_array_del_end, Void, (Any, Uint), a, 1) + ccall(:jl_array_del_end, Void, (Any, UInt), a, 1) return item end function unshift!{T}(a::Array{T,1}, item) item = convert(T, item) - ccall(:jl_array_grow_beg, Void, (Any, Uint), a, 1) + ccall(:jl_array_grow_beg, Void, (Any, UInt), a, 1) a[1] = item return a end @@ -525,7 +525,7 @@ function shift!(a::Vector) error("array must be non-empty") end item = a[1] - ccall(:jl_array_del_beg, Void, (Any, Uint), a, 1) + ccall(:jl_array_del_beg, Void, (Any, UInt), a, 1) return item end @@ -578,7 +578,7 @@ function deleteat!(a::Vector, inds) @inbounds a[p] = a[q] p += 1; q += 1 end - ccall(:jl_array_del_end, Void, (Any, Uint), a, n-p+1) + ccall(:jl_array_del_end, Void, (Any, UInt), a, n-p+1) return a end @@ -640,7 +640,7 @@ function splice!{T<:Integer}(a::Vector, r::UnitRange{T}, ins=_default_splice) end function empty!(a::Vector) - ccall(:jl_array_del_end, Void, (Any, Uint), a, length(a)) + ccall(:jl_array_del_end, Void, (Any, UInt), a, length(a)) return a end @@ -828,8 +828,8 @@ function complex{T<:Real}(A::Array{T}, B::Real) end # use memcmp for lexcmp on byte arrays -function lexcmp(a::Array{Uint8,1}, b::Array{Uint8,1}) - c = ccall(:memcmp, Int32, (Ptr{Uint8}, Ptr{Uint8}, Uint), +function lexcmp(a::Array{UInt8,1}, b::Array{UInt8,1}) + c = ccall(:memcmp, Int32, (Ptr{UInt8}, Ptr{UInt8}, UInt), a, b, min(length(a),length(b))) c < 0 ? -1 : c > 0 ? +1 : cmp(length(a),length(b)) end @@ -1001,7 +1001,7 @@ function vcat{T}(arrays::Vector{T}...) end for a in arrays nba = length(a)*elsz - ccall(:memcpy, Ptr{Void}, (Ptr{Void}, Ptr{Void}, Uint), + ccall(:memcpy, Ptr{Void}, (Ptr{Void}, Ptr{Void}, UInt), ptr+offset, a, nba) offset += nba end diff --git a/base/ascii.jl b/base/ascii.jl index 1dff10a0213db..c9c0035aa2c3c 100644 --- a/base/ascii.jl +++ b/base/ascii.jl @@ -1,7 +1,7 @@ ## from base/boot.jl: # # immutable ASCIIString <: DirectIndexString -# data::Array{Uint8,1} +# data::Array{UInt8,1} # end # @@ -28,7 +28,7 @@ function string(c::ASCIIString...) for s in c n += length(s.data) end - v = Array(Uint8,n) + v = Array(UInt8,n) o = 1 for s in c ls = length(s.data) @@ -98,8 +98,8 @@ write(io::IO, s::ASCIIString) = write(io, s.data) ascii(x) = convert(ASCIIString, x) convert(::Type{ASCIIString}, s::ASCIIString) = s convert(::Type{ASCIIString}, s::UTF8String) = ascii(s.data) -convert(::Type{ASCIIString}, a::Array{Uint8,1}) = is_valid_ascii(a) ? ASCIIString(a) : error("invalid ASCII sequence") -function convert(::Type{ASCIIString}, a::Array{Uint8,1}, invalids_as::ASCIIString) +convert(::Type{ASCIIString}, a::Array{UInt8,1}) = is_valid_ascii(a) ? ASCIIString(a) : error("invalid ASCII sequence") +function convert(::Type{ASCIIString}, a::Array{UInt8,1}, invalids_as::ASCIIString) l = length(a) idx = 1 iscopy = false diff --git a/base/base.jl b/base/base.jl index 7a4e9306ffebe..4ccd3ef82a319 100644 --- a/base/base.jl +++ b/base/base.jl @@ -17,8 +17,8 @@ call(T::Type{UndefVarError}, var::Symbol) = Core.call(T, var) call(T::Type{InterruptException}) = Core.call(T) call(T::Type{SymbolNode}, name::Symbol, t::ANY) = Core.call(T, name, t) call(T::Type{GetfieldNode}, value, name::Symbol, typ) = Core.call(T, value, name, typ) -call(T::Type{ASCIIString}, d::Array{Uint8,1}) = Core.call(T, d) -call(T::Type{UTF8String}, d::Array{Uint8,1}) = Core.call(T, d) +call(T::Type{ASCIIString}, d::Array{UInt8,1}) = Core.call(T, d) +call(T::Type{UTF8String}, d::Array{UInt8,1}) = Core.call(T, d) call(T::Type{TypeVar}, args...) = Core.call(T, args...) call(T::Type{TypeConstructor}, args...) = Core.call(T, args...) call(T::Type{Expr}, args::ANY...) = _expr(args...) @@ -59,7 +59,7 @@ cconvert(T, x) = convert(T, x) # use the code in ccall.cpp to safely allocate temporary pointer arrays cconvert{T}(::Type{Ptr{Ptr{T}}}, a::Array) = a # convert strings to ByteString to pass as pointers -cconvert{P<:Union(Int8,Uint8)}(::Type{Ptr{P}}, s::AbstractString) = bytestring(s) +cconvert{P<:Union(Int8,UInt8)}(::Type{Ptr{P}}, s::AbstractString) = bytestring(s) reinterpret{T,S}(::Type{T}, x::S) = box(T,unbox(S,x)) @@ -127,8 +127,8 @@ ccall(:jl_get_system_hooks, Void, ()) int(x) = convert(Int, x) int(x::Int) = x -uint(x) = convert(Uint, x) -uint(x::Uint) = x +uint(x) = convert(UInt, x) +uint(x::UInt) = x # index colon type Colon @@ -164,14 +164,14 @@ function append_any(xs...) for x in xs for y in x if i > l - ccall(:jl_array_grow_end, Void, (Any, Uint), out, 16) + ccall(:jl_array_grow_end, Void, (Any, UInt), out, 16) l += 16 end arrayset(out, y, i) i += 1 end end - ccall(:jl_array_del_end, Void, (Any, Uint), out, l-i+1) + ccall(:jl_array_del_end, Void, (Any, UInt), out, l-i+1) out end diff --git a/base/base64.jl b/base/base64.jl index 40e1666b1b147..9220c4c112a8b 100644 --- a/base/base64.jl +++ b/base/base64.jl @@ -15,9 +15,9 @@ export Base64Pipe, base64 type Base64Pipe <: IO io::IO # writing works in groups of 3, so we need to cache last two bytes written - b0::Uint8 - b1::Uint8 - nb::Uint8 # number of bytes in cache: 0, 1, or 2 + b0::UInt8 + b1::UInt8 + nb::UInt8 # number of bytes in cache: 0, 1, or 2 function Base64Pipe(io::IO) b = new(io,0,0,0) @@ -32,7 +32,7 @@ end const b64chars = ['A':'Z','a':'z','0':'9','+','/'] -function b64(x::Uint8, y::Uint8, z::Uint8) +function b64(x::UInt8, y::UInt8, z::UInt8) n = int(x)<<16 | int(y)<<8 | int(z) b64chars[(n >> 18) + 1], b64chars[(n >> 12) & 0b111111 + 1], @@ -40,19 +40,19 @@ function b64(x::Uint8, y::Uint8, z::Uint8) b64chars[(n ) & 0b111111 + 1] end -function b64(x::Uint8, y::Uint8) +function b64(x::UInt8, y::UInt8) a, b, c = b64(x, y, 0x0) a, b, c, '=' end -function b64(x::Uint8) +function b64(x::UInt8) a, b = b64(x, 0x0, 0x0) a, b, '=', '=' end ############################################################################# -function write(b::Base64Pipe, x::AbstractVector{Uint8}) +function write(b::Base64Pipe, x::AbstractVector{UInt8}) n = length(x) s = 1 # starting index # finish any cached data to write: @@ -93,7 +93,7 @@ function write(b::Base64Pipe, x::AbstractVector{Uint8}) end end -function write(b::Base64Pipe, x::Uint8) +function write(b::Base64Pipe, x::UInt8) if b.nb == 0 b.b0 = x b.nb = 1 @@ -130,7 +130,7 @@ base64(x...) = base64(write, x...) ############################################################################# -# read(b::Base64Pipe, ::Type{Uint8}) = # TODO: decode base64 +# read(b::Base64Pipe, ::Type{UInt8}) = # TODO: decode base64 ############################################################################# diff --git a/base/bitarray.jl b/base/bitarray.jl index 54387b953db02..40794ba4100e1 100644 --- a/base/bitarray.jl +++ b/base/bitarray.jl @@ -12,7 +12,7 @@ num_bit_chunks(n::Int) = @_div64 (n+63) # notes: bits are stored in contiguous chunks # unused bits must always be set to 0 type BitArray{N} <: DenseArray{Bool, N} - chunks::Vector{Uint64} + chunks::Vector{UInt64} len::Int dims::NTuple{N,Int} function BitArray(dims::Int...) @@ -23,7 +23,7 @@ type BitArray{N} <: DenseArray{Bool, N} n *= d end nc = num_bit_chunks(n) - chunks = Array(Uint64, nc) + chunks = Array(UInt64, nc) nc > 0 && (chunks[end] = uint64(0)) b = new(chunks, n) N != 1 && (b.dims = dims) @@ -52,7 +52,7 @@ isassigned{N}(B::BitArray{N}, i::Int) = 1 <= i <= length(B) get_chunks_id(i::Integer) = @_div64(int(i)-1)+1, @_mod64(int(i)-1) -function glue_src_bitchunks(src::Vector{Uint64}, k::Int, ks1::Int, msk_s0::Uint64, ls0::Int) +function glue_src_bitchunks(src::Vector{UInt64}, k::Int, ks1::Int, msk_s0::UInt64, ls0::Int) @inbounds begin chunk = ((src[k] & msk_s0) >>> ls0) if ks1 > k && ls0 > 0 @@ -63,7 +63,7 @@ function glue_src_bitchunks(src::Vector{Uint64}, k::Int, ks1::Int, msk_s0::Uint6 return chunk end -function copy_chunks!(dest::Vector{Uint64}, pos_d::Integer, src::Vector{Uint64}, pos_s::Integer, numbits::Integer) +function copy_chunks!(dest::Vector{UInt64}, pos_d::Integer, src::Vector{UInt64}, pos_s::Integer, numbits::Integer) numbits == 0 && return if dest === src && pos_d > pos_s return copy_chunks_rtol!(dest, pos_d, pos_s, numbits) @@ -119,7 +119,7 @@ function copy_chunks!(dest::Vector{Uint64}, pos_d::Integer, src::Vector{Uint64}, return end -function copy_chunks_rtol!(chunks::Vector{Uint64}, pos_d::Integer, pos_s::Integer, numbits::Integer) +function copy_chunks_rtol!(chunks::Vector{UInt64}, pos_d::Integer, pos_s::Integer, numbits::Integer) pos_d == pos_s && return pos_d < pos_s && return copy_chunks!(chunks, pos_d, chunks, pos_s, numbits) @@ -167,7 +167,7 @@ function copy_chunks_rtol!(chunks::Vector{Uint64}, pos_d::Integer, pos_s::Intege end end -function fill_chunks!(Bc::Array{Uint64}, x::Bool, pos::Integer, numbits::Integer) +function fill_chunks!(Bc::Array{UInt64}, x::Bool, pos::Integer, numbits::Integer) numbits <= 0 && return k0, l0 = get_chunks_id(pos) k1, l1 = get_chunks_id(pos+numbits-1) @@ -341,7 +341,7 @@ end ## Indexing: getindex ## -function unsafe_bitgetindex(Bc::Vector{Uint64}, i::Int) +function unsafe_bitgetindex(Bc::Vector{UInt64}, i::Int) return (Bc[@_div64(i-1)+1] & (uint64(1)<<@_mod64(i-1))) != 0 end @@ -397,7 +397,7 @@ end ## Indexing: setindex! ## -function unsafe_bitsetindex!(Bc::Array{Uint64}, x::Bool, i::Int) +function unsafe_bitsetindex!(Bc::Array{UInt64}, x::Bool, i::Int) i1, i2 = get_chunks_id(i) u = uint64(1) << i2 @inbounds begin @@ -457,7 +457,7 @@ function push!(B::BitVector, item) l = @_mod64 length(B) if l == 0 - ccall(:jl_array_grow_end, Void, (Any, Uint), Bc, 1) + ccall(:jl_array_grow_end, Void, (Any, UInt), Bc, 1) Bc[end] = uint64(0) end B.len += 1 @@ -477,7 +477,7 @@ function append!(B::BitVector, items::BitVector) k0 = length(Bc) k1 = num_bit_chunks(n0 + n1) if k1 > k0 - ccall(:jl_array_grow_end, Void, (Any, Uint), Bc, k1 - k0) + ccall(:jl_array_grow_end, Void, (Any, UInt), Bc, k1 - k0) Bc[end] = uint64(0) end B.len += n1 @@ -498,7 +498,7 @@ function prepend!(B::BitVector, items::BitVector) k0 = length(Bc) k1 = num_bit_chunks(n0 + n1) if k1 > k0 - ccall(:jl_array_grow_end, Void, (Any, Uint), Bc, k1 - k0) + ccall(:jl_array_grow_end, Void, (Any, UInt), Bc, k1 - k0) Bc[end] = uint64(0) end B.len += n1 @@ -511,7 +511,7 @@ prepend!(B::BitVector, items::AbstractVector{Bool}) = prepend!(B, bitpack(items) prepend!(A::Vector{Bool}, items::BitVector) = prepend!(A, bitunpack(items)) function sizehint(B::BitVector, sz::Integer) - ccall(:jl_array_sizehint, Void, (Any, Uint), B.chunks, num_bit_chunks(sz)) + ccall(:jl_array_sizehint, Void, (Any, UInt), B.chunks, num_bit_chunks(sz)) return B end @@ -527,7 +527,7 @@ function resize!(B::BitVector, n::Integer) k0 = length(Bc) k1 = num_bit_chunks(int(n)) if k1 > k0 - ccall(:jl_array_grow_end, Void, (Any, Uint), Bc, k1 - k0) + ccall(:jl_array_grow_end, Void, (Any, UInt), Bc, k1 - k0) Bc[end] = uint64(0) end B.len = n @@ -540,7 +540,7 @@ function pop!(B::BitVector) B[end] = false l = @_mod64 length(B) - l == 1 && ccall(:jl_array_del_end, Void, (Any, Uint), B.chunks, 1) + l == 1 && ccall(:jl_array_del_end, Void, (Any, UInt), B.chunks, 1) B.len -= 1 return item @@ -553,7 +553,7 @@ function unshift!(B::BitVector, item) l = @_mod64 length(B) if l == 0 - ccall(:jl_array_grow_end, Void, (Any, Uint), Bc, 1) + ccall(:jl_array_grow_end, Void, (Any, UInt), Bc, 1) Bc[end] = uint64(0) end B.len += 1 @@ -581,7 +581,7 @@ function shift!(B::BitVector) l = @_mod64 length(B) if l == 1 - ccall(:jl_array_del_end, Void, (Any, Uint), Bc, 1) + ccall(:jl_array_del_end, Void, (Any, UInt), Bc, 1) else Bc[end] >>>= 1 end @@ -602,7 +602,7 @@ function insert!(B::BitVector, i::Integer, item) l = @_mod64 length(B) if l == 0 - ccall(:jl_array_grow_end, Void, (Any, Uint), Bc, 1) + ccall(:jl_array_grow_end, Void, (Any, UInt), Bc, 1) Bc[end] = uint64(0) end B.len += 1 @@ -641,7 +641,7 @@ function _deleteat!(B::BitVector, i::Integer) l = @_mod64 length(B) if l == 1 - ccall(:jl_array_del_end, Void, (Any, Uint), Bc, 1) + ccall(:jl_array_del_end, Void, (Any, UInt), Bc, 1) elseif length(Bc) > k Bc[end] >>>= 1 end @@ -671,7 +671,7 @@ function deleteat!(B::BitVector, r::UnitRange{Int}) copy_chunks!(Bc, i_f, Bc, i_l+1, n-i_l) - delta_k < 0 && ccall(:jl_array_del_end, Void, (Any, Uint), Bc, -delta_k) + delta_k < 0 && ccall(:jl_array_del_end, Void, (Any, UInt), Bc, -delta_k) B.len = new_l @@ -709,7 +709,7 @@ function deleteat!(B::BitVector, inds) q <= n && copy_chunks!(Bc, p, Bc, q, n-q+1) delta_k = num_bit_chunks(new_l) - length(Bc) - delta_k < 0 && ccall(:jl_array_del_end, Void, (Any, Uint), Bc, -delta_k) + delta_k < 0 && ccall(:jl_array_del_end, Void, (Any, UInt), Bc, -delta_k) B.len = new_l @@ -756,12 +756,12 @@ function splice!(B::BitVector, r::Union(UnitRange{Int}, Integer), ins::AbstractA new_l = length(B) + lins - ldel delta_k = num_bit_chunks(new_l) - length(Bc) - delta_k > 0 && ccall(:jl_array_grow_end, Void, (Any, Uint), Bc, delta_k) + delta_k > 0 && ccall(:jl_array_grow_end, Void, (Any, UInt), Bc, delta_k) copy_chunks!(Bc, i_f+lins, Bc, i_l+1, n-i_l) copy_chunks!(Bc, i_f, Bins.chunks, 1, lins) - delta_k < 0 && ccall(:jl_array_del_end, Void, (Any, Uint), Bc, -delta_k) + delta_k < 0 && ccall(:jl_array_del_end, Void, (Any, UInt), Bc, -delta_k) B.len = new_l @@ -784,7 +784,7 @@ end function empty!(B::BitVector) - ccall(:jl_array_del_end, Void, (Any, Uint), B.chunks, length(B.chunks)) + ccall(:jl_array_del_end, Void, (Any, UInt), B.chunks, length(B.chunks)) B.len = 0 return B end @@ -1152,7 +1152,7 @@ function flipdim(A::BitArray, d::Integer) return B end -function reverse_bits(src::Uint64) +function reverse_bits(src::UInt64) z = src z = ((z >>> 1) & 0x5555555555555555) | ((z << 1) & 0xaaaaaaaaaaaaaaaa) z = ((z >>> 2) & 0x3333333333333333) | ((z << 2) & 0xcccccccccccccccc) @@ -1169,7 +1169,7 @@ function reverse!(B::BitVector) pnc = length(B.chunks) & 1 hnc = (length(B.chunks) >>> 1) - aux_chunks = Array(Uint64, 1) + aux_chunks = Array(UInt64, 1) for i = 1:hnc j = ((i - 1) << 6) @@ -1477,7 +1477,7 @@ transpose(B::BitVector) = reshape(copy(B), 1, length(B)) # fast 8x8 bit transpose from Henry S. Warrens's "Hacker's Delight" # http://www.hackersdelight.org/HDcode/transpose8.c.txt -function transpose8x8(x::Uint64) +function transpose8x8(x::UInt64) y = x t = (y $ (y >>> 7)) & 0x00aa00aa00aa00aa y = y $ t $ (t << 7) @@ -1487,7 +1487,7 @@ function transpose8x8(x::Uint64) return y $ t $ (t << 28) end -function form_8x8_chunk(Bc::Vector{Uint64}, i1::Int, i2::Int, m::Int, cgap::Int, cinc::Int, nc::Int, msk8::Uint64) +function form_8x8_chunk(Bc::Vector{UInt64}, i1::Int, i2::Int, m::Int, cgap::Int, cinc::Int, nc::Int, msk8::UInt64) x = uint64(0) k, l = get_chunks_id(i1 + (i2 - 1) * m) @@ -1507,7 +1507,7 @@ function form_8x8_chunk(Bc::Vector{Uint64}, i1::Int, i2::Int, m::Int, cgap::Int, end # note: assumes B is filled with 0's -function put_8x8_chunk(Bc::Vector{Uint64}, i1::Int, i2::Int, x::Uint64, m::Int, cgap::Int, cinc::Int, nc::Int, msk8::Uint64) +function put_8x8_chunk(Bc::Vector{UInt64}, i1::Int, i2::Int, x::UInt64, m::Int, cgap::Int, cinc::Int, nc::Int, msk8::UInt64) k, l = get_chunks_id(i1 + (i2 - 1) * m) r = 0 for j = 1:8 diff --git a/base/boot.jl b/base/boot.jl index b11a3b3e08a49..0ecec7f2fa14c 100644 --- a/base/boot.jl +++ b/base/boot.jl @@ -125,8 +125,8 @@ export Module, Symbol, Task, Array, # numeric types Bool, FloatingPoint, Float16, Float32, Float64, Number, Integer, Int, Int8, Int16, - Int32, Int64, Int128, Ptr, Real, Signed, Uint, Uint8, Uint16, Uint32, - Uint64, Uint128, Unsigned, + Int32, Int64, Int128, Ptr, Real, Signed, UInt, UInt8, UInt16, UInt32, + UInt64, UInt128, Unsigned, # string types Char, ASCIIString, ByteString, DirectIndexString, AbstractString, UTF8String, # errors @@ -183,20 +183,20 @@ bitstype 8 Bool <: Integer bitstype 32 Char bitstype 8 Int8 <: Signed -bitstype 8 Uint8 <: Unsigned +bitstype 8 UInt8 <: Unsigned bitstype 16 Int16 <: Signed -bitstype 16 Uint16 <: Unsigned +bitstype 16 UInt16 <: Unsigned bitstype 32 Int32 <: Signed -bitstype 32 Uint32 <: Unsigned +bitstype 32 UInt32 <: Unsigned bitstype 64 Int64 <: Signed -bitstype 64 Uint64 <: Unsigned +bitstype 64 UInt64 <: Unsigned bitstype 128 Int128 <: Signed -bitstype 128 Uint128 <: Unsigned +bitstype 128 UInt128 <: Unsigned if is(Int,Int64) - typealias Uint Uint64 + typealias UInt UInt64 else - typealias Uint Uint32 + typealias UInt UInt32 end abstract Exception @@ -230,11 +230,11 @@ type GetfieldNode end immutable ASCIIString <: DirectIndexString - data::Array{Uint8,1} + data::Array{UInt8,1} end immutable UTF8String <: AbstractString - data::Array{Uint8,1} + data::Array{UInt8,1} end typealias ByteString Union(ASCIIString,UTF8String) diff --git a/base/broadcast.jl b/base/broadcast.jl index 26bca2471479b..4106d9b0d69de 100644 --- a/base/broadcast.jl +++ b/base/broadcast.jl @@ -103,7 +103,7 @@ end const bitcache_chunks = 64 # this can be changed const bitcache_size = 64 * bitcache_chunks # do not change this -function dumpbitcache(Bc::Vector{Uint64}, bind::Int, C::Vector{Bool}) +function dumpbitcache(Bc::Vector{UInt64}, bind::Int, C::Vector{Bool}) ind = 1 nc = min(bitcache_chunks, length(Bc)-bind+1) for i = 1:nc @@ -332,7 +332,7 @@ for (f, scalarf, bitf, bitfbody) in ((:.==, :(==), :biteq , :(~a $ b)), (:.<=, :<= , :bitle , :(~a | b))) @eval begin ($f)(A::AbstractArray, B::AbstractArray) = bitbroadcast($scalarf, A, B) - ($bitf)(a::Uint64, b::Uint64) = $bitfbody + ($bitf)(a::UInt64, b::UInt64) = $bitfbody function ($f)(A::AbstractArray{Bool}, B::AbstractArray{Bool}) local shape try @@ -406,7 +406,7 @@ end (.^)(A::BitArray, B::AbstractArray{Bool}) = (B .<= A) (.^)(A::AbstractArray{Bool}, B::AbstractArray{Bool}) = (B .<= A) -function bitcache_pow{T}(Ac::Vector{Uint64}, B::Array{T}, l::Int, ind::Int, C::Vector{Bool}) +function bitcache_pow{T}(Ac::Vector{UInt64}, B::Array{T}, l::Int, ind::Int, C::Vector{Bool}) left = l - ind + 1 @inbounds begin for j = 1:min(bitcache_size, left) diff --git a/base/c.jl b/base/c.jl index fa10ae50543ce..872414be19bc0 100644 --- a/base/c.jl +++ b/base/c.jl @@ -14,22 +14,22 @@ const RTLD_FIRST = 0x00000040 function dlsym(hnd::Ptr, s::Union(Symbol,AbstractString)) hnd == C_NULL && error("NULL library handle") - ccall(:jl_dlsym, Ptr{Void}, (Ptr{Void}, Ptr{Uint8}), hnd, s) + ccall(:jl_dlsym, Ptr{Void}, (Ptr{Void}, Ptr{UInt8}), hnd, s) end function dlsym_e(hnd::Ptr, s::Union(Symbol,AbstractString)) hnd == C_NULL && error("NULL library handle") - ccall(:jl_dlsym_e, Ptr{Void}, (Ptr{Void}, Ptr{Uint8}), hnd, s) + ccall(:jl_dlsym_e, Ptr{Void}, (Ptr{Void}, Ptr{UInt8}), hnd, s) end dlopen(s::Symbol, flags::Integer = RTLD_LAZY | RTLD_DEEPBIND) = dlopen(string(s), flags) dlopen(s::AbstractString, flags::Integer = RTLD_LAZY | RTLD_DEEPBIND) = - ccall(:jl_load_dynamic_library, Ptr{Void}, (Ptr{Uint8},Uint32), s, flags) + ccall(:jl_load_dynamic_library, Ptr{Void}, (Ptr{UInt8},UInt32), s, flags) dlopen_e(s::AbstractString, flags::Integer = RTLD_LAZY | RTLD_DEEPBIND) = - ccall(:jl_load_dynamic_library_e, Ptr{Void}, (Ptr{Uint8},Uint32), s, flags) + ccall(:jl_load_dynamic_library_e, Ptr{Void}, (Ptr{UInt8},UInt32), s, flags) dlopen_e(s::Symbol, flags::Integer = RTLD_LAZY | RTLD_DEEPBIND) = dlopen_e(string(s), flags) @@ -42,29 +42,29 @@ cfunction(f::Function, r, a) = if ccall(:jl_is_char_signed, Any, ()) typealias Cchar Int8 else - typealias Cchar Uint8 + typealias Cchar UInt8 end -typealias Cuchar Uint8 +typealias Cuchar UInt8 typealias Cshort Int16 -typealias Cushort Uint16 +typealias Cushort UInt16 typealias Cint Int32 -typealias Cuint Uint32 +typealias Cuint UInt32 if OS_NAME === :Windows typealias Clong Int32 - typealias Culong Uint32 - typealias Cwchar_t Uint16 + typealias Culong UInt32 + typealias Cwchar_t UInt16 else typealias Clong Int - typealias Culong Uint + typealias Culong UInt typealias Cwchar_t Int32 end typealias Cptrdiff_t Int -typealias Csize_t Uint +typealias Csize_t UInt typealias Cssize_t Int typealias Cintmax_t Int64 -typealias Cuintmax_t Uint64 +typealias Cuintmax_t UInt64 typealias Clonglong Int64 -typealias Culonglong Uint64 +typealias Culonglong UInt64 typealias Cfloat Float32 typealias Cdouble Float64 @@ -113,11 +113,11 @@ function find_library{T<:ByteString, S<:ByteString}(libnames::Array{T,1}, extrap end function ccallable(f::Function, rt::Type, argt::(Type...), name::Union(AbstractString,Symbol)=string(f)) - ccall(:jl_extern_c, Void, (Any, Any, Any, Ptr{Uint8}), f, rt, argt, name) + ccall(:jl_extern_c, Void, (Any, Any, Any, Ptr{UInt8}), f, rt, argt, name) end function ccallable(f::Function, argt::(Type...), name::Union(AbstractString,Symbol)=string(f)) - ccall(:jl_extern_c, Void, (Any, Ptr{Void}, Any, Ptr{Uint8}), f, C_NULL, argt, name) + ccall(:jl_extern_c, Void, (Any, Ptr{Void}, Any, Ptr{UInt8}), f, C_NULL, argt, name) end macro ccallable(def) diff --git a/base/char.jl b/base/char.jl index dee14fec1490d..ee61f6c760702 100644 --- a/base/char.jl +++ b/base/char.jl @@ -3,12 +3,12 @@ char(x::FloatingPoint) = char(iround(x)) integer(x::Char) = int(x) -convert(::Type{Char}, x::Float16) = char(convert(Uint32, x)) -convert(::Type{Char}, x::Float32) = char(convert(Uint32, x)) -convert(::Type{Char}, x::Float64) = char(convert(Uint32, x)) +convert(::Type{Char}, x::Float16) = char(convert(UInt32, x)) +convert(::Type{Char}, x::Float32) = char(convert(UInt32, x)) +convert(::Type{Char}, x::Float64) = char(convert(UInt32, x)) -typemax(::Type{Char}) = char(typemax(Uint32)) -typemin(::Type{Char}) = char(typemin(Uint32)) +typemax(::Type{Char}) = char(typemax(UInt32)) +typemin(::Type{Char}) = char(typemin(UInt32)) ## character operations & comparisons ## size(c::Char) = () diff --git a/base/client.jl b/base/client.jl index 8f8db5a6fc900..6f77d62743c33 100644 --- a/base/client.jl +++ b/base/client.jl @@ -133,13 +133,13 @@ function parse_input_line(s::AbstractString) # s = bytestring(s) # (expr, pos) = parse(s, 1) # (ex, pos) = ccall(:jl_parse_string, Any, - # (Ptr{Uint8},Int32,Int32), + # (Ptr{UInt8},Int32,Int32), # s, int32(pos)-1, 1) # if !is(ex,()) # throw(ParseError("extra input after end of expression")) # end # expr - ccall(:jl_parse_input_line, Any, (Ptr{Uint8},), s) + ccall(:jl_parse_input_line, Any, (Ptr{UInt8},), s) end function parse_input_line(io::IO) diff --git a/base/combinatorics.jl b/base/combinatorics.jl index cdfacaf19d4a0..ebab3e4a965de 100644 --- a/base/combinatorics.jl +++ b/base/combinatorics.jl @@ -4,7 +4,7 @@ const _fact_table64 = 121645100408832000,2432902008176640000] const _fact_table128 = - Uint128[0x00000000000000000000000000000001, 0x00000000000000000000000000000002, + UInt128[0x00000000000000000000000000000001, 0x00000000000000000000000000000002, 0x00000000000000000000000000000006, 0x00000000000000000000000000000018, 0x00000000000000000000000000000078, 0x000000000000000000000000000002d0, 0x000000000000000000000000000013b0, 0x00000000000000000000000000009d80, @@ -31,17 +31,17 @@ function factorial_lookup(n::Integer, table, lim) end factorial(n::Int128) = factorial_lookup(n, _fact_table128, 33) -factorial(n::Uint128) = factorial_lookup(n, _fact_table128, 34) -factorial(n::Union(Int64,Uint64)) = factorial_lookup(n, _fact_table64, 20) +factorial(n::UInt128) = factorial_lookup(n, _fact_table128, 34) +factorial(n::Union(Int64,UInt64)) = factorial_lookup(n, _fact_table64, 20) if Int === Int32 -factorial(n::Union(Int8,Uint8,Int16,Uint16)) = factorial(int32(n)) -factorial(n::Union(Int32,Uint32)) = factorial_lookup(n, _fact_table64, 12) +factorial(n::Union(Int8,UInt8,Int16,UInt16)) = factorial(int32(n)) +factorial(n::Union(Int32,UInt32)) = factorial_lookup(n, _fact_table64, 12) else -factorial(n::Union(Int8,Uint8,Int16,Uint16,Int32,Uint32)) = factorial(int64(n)) +factorial(n::Union(Int8,UInt8,Int16,UInt16,Int32,UInt32)) = factorial(int64(n)) end -function gamma(n::Union(Int8,Uint8,Int16,Uint16,Int32,Uint32,Int64,Uint64)) +function gamma(n::Union(Int8,UInt8,Int16,UInt16,Int32,UInt32,Int64,UInt64)) n < 0 && throw(DomainError()) n == 0 && return Inf n <= 2 && return 1.0 diff --git a/base/constants.jl b/base/constants.jl index c5ac448fe8ef2..96fdb852cfeca 100644 --- a/base/constants.jl +++ b/base/constants.jl @@ -21,7 +21,7 @@ end =={s}(::MathConst{s}, ::MathConst{s}) = true ==(::MathConst, ::MathConst) = false -hash(x::MathConst, h::Uint) = hash(object_id(x), h) +hash(x::MathConst, h::UInt) = hash(object_id(x), h) -(x::MathConst) = -float64(x) for op in Symbol[:+, :-, :*, :/, :^] diff --git a/base/dSFMT.jl b/base/dSFMT.jl index f123dd1d703b7..62e99c62d6d5f 100644 --- a/base/dSFMT.jl +++ b/base/dSFMT.jl @@ -12,7 +12,7 @@ end function dsfmt_get_idstring() idstring = ccall((:dsfmt_get_idstring,:libdSFMT), - Ptr{Uint8}, + Ptr{UInt8}, ()) return bytestring(idstring) end @@ -25,17 +25,17 @@ end const dsfmt_min_array_size = dsfmt_get_min_array_size() -function dsfmt_init_gen_rand(s::DSFMT_state, seed::Uint32) +function dsfmt_init_gen_rand(s::DSFMT_state, seed::UInt32) ccall((:dsfmt_init_gen_rand,:libdSFMT), Void, - (Ptr{Void}, Uint32,), + (Ptr{Void}, UInt32,), s.val, seed) end -function dsfmt_init_by_array(s::DSFMT_state, seed::Vector{Uint32}) +function dsfmt_init_by_array(s::DSFMT_state, seed::Vector{UInt32}) ccall((:dsfmt_init_by_array,:libdSFMT), Void, - (Ptr{Void}, Ptr{Uint32}, Int32), + (Ptr{Void}, Ptr{UInt32}, Int32), s.val, seed, length(seed)) end @@ -61,8 +61,8 @@ end ## Windows entropy @windows_only begin - function win32_SystemFunction036!(a::Array{Uint32}) - ccall((:SystemFunction036,:Advapi32),stdcall,Uint8,(Ptr{Void},Uint32),a,length(a)*sizeof(eltype(a))) + function win32_SystemFunction036!(a::Array{UInt32}) + ccall((:SystemFunction036,:Advapi32),stdcall,UInt8,(Ptr{Void},UInt32),a,length(a)*sizeof(eltype(a))) end end diff --git a/base/datafmt.jl b/base/datafmt.jl index 83810cb62139e..cd932d90912d4 100644 --- a/base/datafmt.jl +++ b/base/datafmt.jl @@ -21,7 +21,7 @@ function countlines(io::IO, eol::Char) if !isascii(eol) error("only ASCII line terminators are supported") end - a = Array(Uint8, 8192) + a = Array(UInt8, 8192) nl = 0 preceded_by_eol = true while !eof(io) @@ -51,7 +51,7 @@ function readdlm_auto(input, dlm::Char, T::Type, eol::Char, auto::Bool; opts...) optsd = val_opts(opts) use_mmap = get(optsd, :use_mmap, @windows ? false : true) isa(input, AbstractString) && (fsz = filesize(input); input = use_mmap && (fsz > 0) && fsz < typemax(Int) ? as_mmap(input,fsz) : readall(input)) - sinp = isa(input, Vector{Uint8}) ? bytestring(input) : + sinp = isa(input, Vector{UInt8}) ? bytestring(input) : isa(input, IO) ? readall(input) : input readdlm_string(sinp, dlm, T, eol, auto, optsd) @@ -59,7 +59,7 @@ end function as_mmap(fname::AbstractString, fsz::Int64) open(fname) do io - mmap_array(Uint8, (int(fsz),), io) + mmap_array(UInt8, (int(fsz),), io) end end @@ -326,7 +326,7 @@ dlm_parse(s::ASCIIString, eol::Char, dlm::Char, qchar::Char, cchar::Char, ign_ad end function dlm_parse{T,D}(dbuff::T, eol::D, dlm::D, qchar::D, cchar::D, ign_adj_dlm::Bool, allow_quote::Bool, allow_comments::Bool, skipstart::Int, skipblanks::Bool, dh::DLMHandler) - all_ascii = (D <: Uint8) || (isascii(eol) && isascii(dlm) && (!allow_quote || isascii(qchar)) && (!allow_comments || isascii(cchar))) + all_ascii = (D <: UInt8) || (isascii(eol) && isascii(dlm) && (!allow_quote || isascii(qchar)) && (!allow_comments || isascii(cchar))) (T <: UTF8String) && all_ascii && (return dlm_parse(dbuff.data, uint8(eol), uint8(dlm), uint8(qchar), uint8(cchar), ign_adj_dlm, allow_quote, allow_comments, skipstart, skipblanks, dh)) ncols = nrows = col = 0 is_default_dlm = (dlm == uint32(invalid_dlm) % D) diff --git a/base/deepcopy.jl b/base/deepcopy.jl index 07e7add299cf2..4677cdebc729e 100644 --- a/base/deepcopy.jl +++ b/base/deepcopy.jl @@ -38,7 +38,7 @@ function _deepcopy_t(x, T::DataType, stackdict::ObjectIdDict) end else fields = Any[deepcopy_internal(x.(i), stackdict) for i in 1:length(T.names)] - y = ccall(:jl_new_structv, Any, (Any, Ptr{Void}, Uint32), + y = ccall(:jl_new_structv, Any, (Any, Ptr{Void}, UInt32), T, pointer(fields), length(fields)) end return y::T diff --git a/base/deprecated.jl b/base/deprecated.jl index 536f33e03482d..547d07e5d9aa7 100644 --- a/base/deprecated.jl +++ b/base/deprecated.jl @@ -135,10 +135,10 @@ Set{T<:Number}(xs::T...) = Set{T}(xs) @deprecate infs(dims...) fill(Inf, dims) @deprecate infs{T}(x::AbstractArray{T}) fill(convert(T,Inf), size(x)) -@deprecate bitmix(x, y::Uint) hash(x, y) +@deprecate bitmix(x, y::UInt) hash(x, y) @deprecate bitmix(x, y::Int) hash(x, uint(y)) -@deprecate bitmix(x, y::Union(Uint32, Int32)) convert(Uint32, hash(x, uint(y))) -@deprecate bitmix(x, y::Union(Uint64, Int64)) convert(Uint64, hash(x, hash(y))) +@deprecate bitmix(x, y::Union(UInt32, Int32)) convert(UInt32, hash(x, uint(y))) +@deprecate bitmix(x, y::Union(UInt64, Int64)) convert(UInt64, hash(x, hash(y))) @deprecate readsfrom(cmd, args...) open(cmd, "r", args...) @deprecate writesto(cmd, args...) open(cmd, "w", args...) @@ -152,7 +152,7 @@ function tty_cols() tty_size()[2] end -@deprecate pointer{T}(::Type{T}, x::Uint) convert(Ptr{T}, x) +@deprecate pointer{T}(::Type{T}, x::UInt) convert(Ptr{T}, x) @deprecate pointer{T}(::Type{T}, x::Ptr) convert(Ptr{T}, x) # 0.3 discontinued functions @@ -215,3 +215,11 @@ end export String const String = AbstractString + +export Uint, Uint8, Uint16, Uint32, Uint64, Uint128 +const Uint = UInt +const Uint8 = UInt8 +const Uint16 = UInt16 +const Uint32 = UInt32 +const Uint64 = UInt64 +const Uint128 = UInt128 diff --git a/base/dict.jl b/base/dict.jl index 8f7f7576eb97d..e2e642c33ffb0 100644 --- a/base/dict.jl +++ b/base/dict.jl @@ -265,7 +265,7 @@ type ObjectIdDict <: Associative{Any,Any} function ObjectIdDict(o::ObjectIdDict) N = length(o.ht) ht = cell(N) - ccall(:memcpy, Ptr{Void}, (Ptr{Void}, Ptr{Void}, Uint), + ccall(:memcpy, Ptr{Void}, (Ptr{Void}, Ptr{Void}, UInt), ht, o.ht, N*sizeof(Ptr)) new(ht) end @@ -315,7 +315,7 @@ copy(o::ObjectIdDict) = ObjectIdDict(o) # dict type Dict{K,V} <: Associative{K,V} - slots::Array{Uint8,1} + slots::Array{UInt8,1} keys::Array{K,1} vals::Array{V,1} ndel::Int @@ -324,7 +324,7 @@ type Dict{K,V} <: Associative{K,V} function Dict() n = 16 - new(zeros(Uint8,n), Array(K,n), Array(V,n), 0, 0, identity) + new(zeros(UInt8,n), Array(K,n), Array(V,n), 0, 0, identity) end function Dict(kv) h = Dict{K,V}() @@ -429,7 +429,7 @@ function rehash{K,V}(h::Dict{K,V}, newsz) return h end - slots = zeros(Uint8,newsz) + slots = zeros(UInt8,newsz) keys = Array(K, newsz) vals = Array(V, newsz) count0 = h.count @@ -676,8 +676,8 @@ end function _delete!(h::Dict, index) h.slots[index] = 0x2 - ccall(:jl_arrayunset, Void, (Any, Uint), h.keys, index-1) - ccall(:jl_arrayunset, Void, (Any, Uint), h.vals, index-1) + ccall(:jl_arrayunset, Void, (Any, UInt), h.keys, index-1) + ccall(:jl_arrayunset, Void, (Any, UInt), h.vals, index-1) h.ndel += 1 h.count -= 1 h diff --git a/base/env.jl b/base/env.jl index 90e5412556883..ebc40a10fa137 100644 --- a/base/env.jl +++ b/base/env.jl @@ -1,7 +1,7 @@ ## core libc calls ## @unix_only begin - _getenv(var::AbstractString) = ccall(:getenv, Ptr{Uint8}, (Ptr{Uint8},), var) + _getenv(var::AbstractString) = ccall(:getenv, Ptr{UInt8}, (Ptr{UInt8},), var) _hasenv(s::AbstractString) = _getenv(s) != C_NULL end @windows_only begin @@ -10,28 +10,28 @@ const FORMAT_MESSAGE_ALLOCATE_BUFFER = uint32(0x100) const FORMAT_MESSAGE_FROM_SYSTEM = uint32(0x1000) const FORMAT_MESSAGE_IGNORE_INSERTS = uint32(0x200) const FORMAT_MESSAGE_MAX_WIDTH_MASK = uint32(0xFF) -GetLastError() = ccall(:GetLastError,stdcall,Uint32,()) +GetLastError() = ccall(:GetLastError,stdcall,UInt32,()) function FormatMessage(e=GetLastError()) - lpMsgBuf = Array(Ptr{Uint16}) + lpMsgBuf = Array(Ptr{UInt16}) lpMsgBuf[1] = 0 - len = ccall(:FormatMessageW,stdcall,Uint32,(Cint, Ptr{Void}, Cint, Cint, Ptr{Ptr{Uint16}}, Cint, Ptr{Void}), + len = ccall(:FormatMessageW,stdcall,UInt32,(Cint, Ptr{Void}, Cint, Cint, Ptr{Ptr{UInt16}}, Cint, Ptr{Void}), FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_MAX_WIDTH_MASK, C_NULL, e, 0, lpMsgBuf, 0, C_NULL) p = lpMsgBuf[1] len == 0 && return utf8("") len = len + 1 - buf = Array(Uint16, len) + buf = Array(UInt16, len) unsafe_copy!(pointer(buf), p, len) ccall(:LocalFree,stdcall,Ptr{Void},(Ptr{Void},),p) return utf8(UTF16String(buf)) end -_getenvlen(var::UTF16String) = ccall(:GetEnvironmentVariableW,stdcall,Uint32,(Ptr{Uint16},Ptr{Uint8},Uint32),utf16(var),C_NULL,0) +_getenvlen(var::UTF16String) = ccall(:GetEnvironmentVariableW,stdcall,UInt32,(Ptr{UInt16},Ptr{UInt8},UInt32),utf16(var),C_NULL,0) _hasenv(s::UTF16String) = _getenvlen(s)!=0 || GetLastError()!=ERROR_ENVVAR_NOT_FOUND _hasenv(s::AbstractString) = _hasenv(utf16(s)) -function _jl_win_getenv(s::UTF16String,len::Uint32) - val=zeros(Uint16,len) - ret=ccall(:GetEnvironmentVariableW,stdcall,Uint32,(Ptr{Uint16},Ptr{Uint16},Uint32),s,val,len) +function _jl_win_getenv(s::UTF16String,len::UInt32) + val=zeros(UInt16,len) + ret=ccall(:GetEnvironmentVariableW,stdcall,UInt32,(Ptr{UInt16},Ptr{UInt16},UInt32),s,val,len) if ret==0 || ret != len-1 || val[end] != 0 error(string("system error getenv: ", s, ' ', len, "-1 != ", ret, ": ", FormatMessage())) end @@ -64,13 +64,13 @@ end function _setenv(var::AbstractString, val::AbstractString, overwrite::Bool) @unix_only begin - ret = ccall(:setenv, Int32, (Ptr{Uint8},Ptr{Uint8},Int32), var, val, overwrite) + ret = ccall(:setenv, Int32, (Ptr{UInt8},Ptr{UInt8},Int32), var, val, overwrite) systemerror(:setenv, ret != 0) end @windows_only begin var = utf16(var) if overwrite || !_hasenv(var) - ret = ccall(:SetEnvironmentVariableW,stdcall,Int32,(Ptr{Uint16},Ptr{Uint16}),utf16(var),utf16(val)) + ret = ccall(:SetEnvironmentVariableW,stdcall,Int32,(Ptr{UInt16},Ptr{UInt16}),utf16(var),utf16(val)) systemerror(:setenv, ret == 0) end end @@ -80,11 +80,11 @@ _setenv(var::AbstractString, val::AbstractString) = _setenv(var, val, true) function _unsetenv(var::AbstractString) @unix_only begin - ret = ccall(:unsetenv, Int32, (Ptr{Uint8},), var) + ret = ccall(:unsetenv, Int32, (Ptr{UInt8},), var) systemerror(:unsetenv, ret != 0) end @windows_only begin - ret = ccall(:SetEnvironmentVariableW,stdcall,Int32,(Ptr{Uint16},Ptr{Uint16}),utf16(var),C_NULL) + ret = ccall(:SetEnvironmentVariableW,stdcall,Int32,(Ptr{UInt16},Ptr{UInt16}),utf16(var),C_NULL) systemerror(:setenv, ret == 0) end end @@ -132,19 +132,19 @@ end end @windows_only begin -start(hash::EnvHash) = (pos = ccall(:GetEnvironmentStringsW,stdcall,Ptr{Uint16},()); (pos,pos)) -function done(hash::EnvHash, block::(Ptr{Uint16},Ptr{Uint16})) +start(hash::EnvHash) = (pos = ccall(:GetEnvironmentStringsW,stdcall,Ptr{UInt16},()); (pos,pos)) +function done(hash::EnvHash, block::(Ptr{UInt16},Ptr{UInt16})) if unsafe_load(block[1])==0 - ccall(:FreeEnvironmentStringsW,stdcall,Int32,(Ptr{Uint16},),block[2]) + ccall(:FreeEnvironmentStringsW,stdcall,Int32,(Ptr{UInt16},),block[2]) return true end false end -function next(hash::EnvHash, block::(Ptr{Uint16},Ptr{Uint16})) +function next(hash::EnvHash, block::(Ptr{UInt16},Ptr{UInt16})) pos = block[1] blk = block[2] - len = ccall(:wcslen, Uint, (Ptr{Uint16},), pos)+1 - buf = Array(Uint16, len) + len = ccall(:wcslen, UInt, (Ptr{UInt16},), pos)+1 + buf = Array(UInt16, len) unsafe_copy!(pointer(buf), pos, len) env = utf8(UTF16String(buf)) m = match(r"^(=?[^=]+)=(.*)$"s, env) diff --git a/base/error.jl b/base/error.jl index ed863673ce03b..16ea85d213645 100644 --- a/base/error.jl +++ b/base/error.jl @@ -34,7 +34,7 @@ catch_backtrace() = ccall(:jl_get_backtrace, Array{Ptr{Void},1}, ()) errno() = ccall(:jl_errno, Cint, ()) errno(e::Integer) = ccall(:jl_set_errno, Void, (Cint,), e) -strerror(e::Integer) = bytestring(ccall(:strerror, Ptr{Uint8}, (Int32,), e)) +strerror(e::Integer) = bytestring(ccall(:strerror, Ptr{UInt8}, (Int32,), e)) strerror() = strerror(errno()) systemerror(p, b::Bool) = b ? throw(SystemError(string(p))) : nothing diff --git a/base/expr.jl b/base/expr.jl index afddeca15ceb2..3368acbd1641e 100644 --- a/base/expr.jl +++ b/base/expr.jl @@ -3,16 +3,16 @@ symbol(s::Symbol) = s symbol(s::ASCIIString) = symbol(s.data) symbol(s::UTF8String) = symbol(s.data) -symbol(a::Array{Uint8,1}) = - ccall(:jl_symbol_n, Any, (Ptr{Uint8}, Int32), a, length(a))::Symbol +symbol(a::Array{UInt8,1}) = + ccall(:jl_symbol_n, Any, (Ptr{UInt8}, Int32), a, length(a))::Symbol symbol(x::Char) = symbol(string(x)) gensym() = ccall(:jl_gensym, Any, ())::Symbol gensym(s::ASCIIString) = gensym(s.data) gensym(s::UTF8String) = gensym(s.data) -gensym(a::Array{Uint8,1}) = - ccall(:jl_tagged_gensym, Any, (Ptr{Uint8}, Int32), a, length(a))::Symbol +gensym(a::Array{UInt8,1}) = + ccall(:jl_tagged_gensym, Any, (Ptr{UInt8}, Int32), a, length(a))::Symbol gensym(ss::Union(ASCIIString, UTF8String)...) = map(gensym, ss) macro gensym(names...) diff --git a/base/fftw.jl b/base/fftw.jl index e21076791bd8d..1351fa20dd136 100644 --- a/base/fftw.jl +++ b/base/fftw.jl @@ -71,16 +71,16 @@ typealias fftwTypeSingle Union(Type{Float32},Type{Complex64}) # FFTW's api/import-wisdom-from-file.c file]. function export_wisdom(fname::AbstractString) - f = ccall(:fopen, Ptr{Void}, (Ptr{Uint8},Ptr{Uint8}), fname, "w") + f = ccall(:fopen, Ptr{Void}, (Ptr{UInt8},Ptr{UInt8}), fname, "w") systemerror("could not open wisdom file $fname for writing", f == C_NULL) ccall((:fftw_export_wisdom_to_file,libfftw), Void, (Ptr{Void},), f) - ccall(:fputs, Int32, (Ptr{Uint8},Ptr{Void}), " "^256, f) + ccall(:fputs, Int32, (Ptr{UInt8},Ptr{Void}), " "^256, f) ccall((:fftwf_export_wisdom_to_file,libfftwf), Void, (Ptr{Void},), f) ccall(:fclose, Void, (Ptr{Void},), f) end function import_wisdom(fname::AbstractString) - f = ccall(:fopen, Ptr{Void}, (Ptr{Uint8},Ptr{Uint8}), fname, "r") + f = ccall(:fopen, Ptr{Void}, (Ptr{UInt8},Ptr{UInt8}), fname, "r") systemerror("could not open wisdom file $fname for reading", f == C_NULL) if ccall((:fftw_import_wisdom_from_file,libfftw),Int32,(Ptr{Void},),f)==0|| ccall((:fftwf_import_wisdom_from_file,libfftwf),Int32,(Ptr{Void},),f)==0 @@ -305,7 +305,7 @@ for (Tr,Tc,fftw,lib) in ((:Float64,:Complex128,"fftw",libfftw), plan = ccall(($(string(fftw,"_plan_guru64_dft")),$lib), Ptr{Void}, (Int32, Ptr{Int}, Int32, Ptr{Int}, - Ptr{$Tc}, Ptr{$Tc}, Int32, Uint32), + Ptr{$Tc}, Ptr{$Tc}, Int32, UInt32), size(dims,2), dims, size(howmany,2), howmany, X, Y, direction, flags) set_timelimit($Tr, NO_TIMELIMIT) @@ -323,7 +323,7 @@ for (Tr,Tc,fftw,lib) in ((:Float64,:Complex128,"fftw",libfftw), plan = ccall(($(string(fftw,"_plan_guru64_dft_r2c")),$lib), Ptr{Void}, (Int32, Ptr{Int}, Int32, Ptr{Int}, - Ptr{$Tr}, Ptr{$Tc}, Uint32), + Ptr{$Tr}, Ptr{$Tc}, UInt32), size(dims,2), dims, size(howmany,2), howmany, X, Y, flags) set_timelimit($Tr, NO_TIMELIMIT) @@ -341,7 +341,7 @@ for (Tr,Tc,fftw,lib) in ((:Float64,:Complex128,"fftw",libfftw), plan = ccall(($(string(fftw,"_plan_guru64_dft_c2r")),$lib), Ptr{Void}, (Int32, Ptr{Int}, Int32, Ptr{Int}, - Ptr{$Tc}, Ptr{$Tr}, Uint32), + Ptr{$Tc}, Ptr{$Tr}, UInt32), size(dims,2), dims, size(howmany,2), howmany, X, Y, flags) set_timelimit($Tr, NO_TIMELIMIT) @@ -360,7 +360,7 @@ for (Tr,Tc,fftw,lib) in ((:Float64,:Complex128,"fftw",libfftw), plan = ccall(($(string(fftw,"_plan_guru64_r2r")),$lib), Ptr{Void}, (Int32, Ptr{Int}, Int32, Ptr{Int}, - Ptr{$Tr}, Ptr{$Tr}, Ptr{Int32}, Uint32), + Ptr{$Tr}, Ptr{$Tr}, Ptr{Int32}, UInt32), size(dims,2), dims, size(howmany,2), howmany, X, Y, kinds, flags) set_timelimit($Tr, NO_TIMELIMIT) @@ -383,7 +383,7 @@ for (Tr,Tc,fftw,lib) in ((:Float64,:Complex128,"fftw",libfftw), plan = ccall(($(string(fftw,"_plan_guru64_r2r")),$lib), Ptr{Void}, (Int32, Ptr{Int}, Int32, Ptr{Int}, - Ptr{$Tc}, Ptr{$Tc}, Ptr{Int32}, Uint32), + Ptr{$Tc}, Ptr{$Tc}, Ptr{Int32}, UInt32), size(dims,2), dims, size(howmany,2), howmany, X, Y, kinds, flags) set_timelimit($Tr, NO_TIMELIMIT) diff --git a/base/file.jl b/base/file.jl index 1da8ed93f5bea..8f3971f3577a0 100644 --- a/base/file.jl +++ b/base/file.jl @@ -1,19 +1,19 @@ # get and set current directory function pwd() - b = Array(Uint8,1024) + b = Array(UInt8,1024) len = Csize_t[length(b),] - uv_error(:getcwd, ccall(:uv_cwd, Cint, (Ptr{Uint8}, Ptr{Csize_t}), b, len)) + uv_error(:getcwd, ccall(:uv_cwd, Cint, (Ptr{UInt8}, Ptr{Csize_t}), b, len)) bytestring(b[1:len[1]-1]) end function cd(dir::AbstractString) - uv_error("chdir $dir", ccall(:uv_chdir, Cint, (Ptr{Uint8},), dir)) + uv_error("chdir $dir", ccall(:uv_chdir, Cint, (Ptr{UInt8},), dir)) end cd() = cd(homedir()) @unix_only function cd(f::Function, dir::AbstractString, args...) - fd = ccall(:open,Int32,(Ptr{Uint8},Int32),".",0) + fd = ccall(:open,Int32,(Ptr{UInt8},Int32),".",0) systemerror(:open, fd == -1) try cd(dir) @@ -35,8 +35,8 @@ end cd(f::Function) = cd(f, homedir()) function mkdir(path::AbstractString, mode::Unsigned=0o777) - @unix_only ret = ccall(:mkdir, Int32, (Ptr{Uint8},Uint32), path, mode) - @windows_only ret = ccall(:_wmkdir, Int32, (Ptr{Uint16},), utf16(path)) + @unix_only ret = ccall(:mkdir, Int32, (Ptr{UInt8},UInt32), path, mode) + @windows_only ret = ccall(:_wmkdir, Int32, (Ptr{UInt16},), utf16(path)) systemerror(:mkdir, ret != 0) end @@ -61,8 +61,8 @@ function rm(path::AbstractString; recursive::Bool=false) rm(joinpath(path, p), recursive=true) end end - @unix_only ret = ccall(:rmdir, Int32, (Ptr{Uint8},), path) - @windows_only ret = ccall(:_wrmdir, Int32, (Ptr{Uint16},), utf16(path)) + @unix_only ret = ccall(:rmdir, Int32, (Ptr{UInt8},), path) + @windows_only ret = ccall(:_wrmdir, Int32, (Ptr{UInt16},), utf16(path)) systemerror(:rmdir, ret != 0) end end @@ -87,7 +87,7 @@ end # Obtain a temporary filename. @unix_only function tempname() d = get(ENV, "TMPDIR", C_NULL) # tempnam ignores TMPDIR on darwin - p = ccall(:tempnam, Ptr{Uint8}, (Ptr{Uint8},Ptr{Uint8}), d, "julia") + p = ccall(:tempnam, Ptr{UInt8}, (Ptr{UInt8},Ptr{UInt8}), d, "julia") systemerror(:tempnam, p == C_NULL) s = bytestring(p) c_free(p) @@ -100,24 +100,24 @@ end # Create and return the name of a temporary file along with an IOStream @unix_only function mktemp() b = joinpath(tempdir(), "tmpXXXXXX") - p = ccall(:mkstemp, Int32, (Ptr{Uint8}, ), b) # modifies b + p = ccall(:mkstemp, Int32, (Ptr{UInt8}, ), b) # modifies b return (b, fdio(p, true)) end @windows_only begin function tempdir() - temppath = Array(Uint16,32767) - lentemppath = ccall(:GetTempPathW,stdcall,Uint32,(Uint32,Ptr{Uint16}),length(temppath),temppath) + temppath = Array(UInt16,32767) + lentemppath = ccall(:GetTempPathW,stdcall,UInt32,(UInt32,Ptr{UInt16}),length(temppath),temppath) if lentemppath >= length(temppath) || lentemppath == 0 error("GetTempPath failed: $(FormatMessage())") end resize!(temppath,lentemppath+1) return utf8(UTF16String(temppath)) end -tempname(uunique::Uint32=uint32(0)) = tempname(tempdir(), uunique) -function tempname(temppath::AbstractString,uunique::Uint32) - tname = Array(Uint16,32767) - uunique = ccall(:GetTempFileNameW,stdcall,Uint32,(Ptr{Uint16},Ptr{Uint16},Uint32,Ptr{Uint16}), +tempname(uunique::UInt32=uint32(0)) = tempname(tempdir(), uunique) +function tempname(temppath::AbstractString,uunique::UInt32) + tname = Array(UInt16,32767) + uunique = ccall(:GetTempFileNameW,stdcall,UInt32,(Ptr{UInt16},Ptr{UInt16},UInt32,Ptr{UInt16}), utf16(temppath),utf16("jul"),uunique,tname) lentname = findfirst(tname,0)-1 if uunique == 0 || lentname <= 0 @@ -135,19 +135,19 @@ end # Create and return the name of a temporary directory @unix_only function mktempdir() b = joinpath(tempdir(), "tmpXXXXXX") - p = ccall(:mkdtemp, Ptr{Uint8}, (Ptr{Uint8}, ), b) + p = ccall(:mkdtemp, Ptr{UInt8}, (Ptr{UInt8}, ), b) return bytestring(p) end @windows_only function mktempdir() - seed::Uint32 = rand(Uint32) + seed::UInt32 = rand(UInt32) dir = tempdir() while true - if (seed & typemax(Uint16)) == 0 + if (seed & typemax(UInt16)) == 0 seed += 1 end filename = tempname(dir, seed) - ret = ccall(:_wmkdir, Int32, (Ptr{Uint16},), utf16(filename)) + ret = ccall(:_wmkdir, Int32, (Ptr{UInt16},), utf16(filename)) if ret == 0 return filename end @@ -158,10 +158,10 @@ end function readdir(path::AbstractString) # Allocate space for uv_fs_t struct - uv_readdir_req = zeros(Uint8, ccall(:jl_sizeof_uv_fs_t, Int32, ())) + uv_readdir_req = zeros(UInt8, ccall(:jl_sizeof_uv_fs_t, Int32, ())) # defined in sys.c, to call uv_fs_readdir, which sets errno on error. - file_count = ccall(:jl_readdir, Int32, (Ptr{Uint8}, Ptr{Uint8}), + file_count = ccall(:jl_readdir, Int32, (Ptr{UInt8}, Ptr{UInt8}), path, uv_readdir_req) systemerror("unable to read directory $path", file_count < 0) @@ -172,14 +172,14 @@ function readdir(path::AbstractString) offset = 0 for i = 1:file_count - entry = bytestring(ccall(:jl_uv_fs_t_ptr_offset, Ptr{Uint8}, - (Ptr{Uint8}, Int32), uv_readdir_req, offset)) + entry = bytestring(ccall(:jl_uv_fs_t_ptr_offset, Ptr{UInt8}, + (Ptr{UInt8}, Int32), uv_readdir_req, offset)) push!(entries, entry) offset += sizeof(entry) + 1 # offset to the next entry end # Clean up the request string - ccall(:jl_uv_fs_req_cleanup, Void, (Ptr{Uint8},), uv_readdir_req) + ccall(:jl_uv_fs_req_cleanup, Void, (Ptr{UInt8},), uv_readdir_req) entries end diff --git a/base/float.jl b/base/float.jl index 212114cb7454b..ffcff8a459a42 100644 --- a/base/float.jl +++ b/base/float.jl @@ -1,17 +1,17 @@ ## conversions to floating-point ## -convert(::Type{Float32}, x::Int128) = float32(reinterpret(Uint128,abs(x)))*(1-2(x<0)) -convert(::Type{Float32}, x::Uint128) = float32(uint64(x&0xffffffffffffffff)) + ldexp(float32(uint64(x>>>64)),64) +convert(::Type{Float32}, x::Int128) = float32(reinterpret(UInt128,abs(x)))*(1-2(x<0)) +convert(::Type{Float32}, x::UInt128) = float32(uint64(x&0xffffffffffffffff)) + ldexp(float32(uint64(x>>>64)),64) promote_rule(::Type{Float32}, ::Type{Int128} ) = Float32 -promote_rule(::Type{Float32}, ::Type{Uint128}) = Float32 +promote_rule(::Type{Float32}, ::Type{UInt128}) = Float32 -convert(::Type{Float64}, x::Int128) = float64(reinterpret(Uint128,abs(x)))*(1-2(x<0)) -convert(::Type{Float64}, x::Uint128) = float64(uint64(x&0xffffffffffffffff)) + ldexp(float64(uint64(x>>>64)),64) +convert(::Type{Float64}, x::Int128) = float64(reinterpret(UInt128,abs(x)))*(1-2(x<0)) +convert(::Type{Float64}, x::UInt128) = float64(uint64(x&0xffffffffffffffff)) + ldexp(float64(uint64(x>>>64)),64) promote_rule(::Type{Float64}, ::Type{Int128} ) = Float64 -promote_rule(::Type{Float64}, ::Type{Uint128}) = Float64 +promote_rule(::Type{Float64}, ::Type{UInt128}) = Float64 convert(::Type{Float16}, x::Integer) = convert(Float16, convert(Float32,x)) -for t in (Bool,Char,Int8,Int16,Int32,Int64,Uint8,Uint16,Uint32,Uint64) +for t in (Bool,Char,Int8,Int16,Int32,Int64,UInt8,UInt16,UInt32,UInt64) @eval promote_rule(::Type{Float16}, ::Type{$t}) = Float32 end @@ -22,7 +22,7 @@ for t1 in (Float32,Float64) promote_rule(::Type{$t1}, ::Type{$st} ) = $t1 end end - for ut in (Bool,Char,Uint8,Uint16,Uint32,Uint64) + for ut in (Bool,Char,UInt8,UInt16,UInt32,UInt64) @eval begin convert(::Type{$t1},x::($ut)) = box($t1,uitofp($t1,unbox($ut,x))) promote_rule(::Type{$t1}, ::Type{$ut} ) = $t1 @@ -44,11 +44,11 @@ convert(::Type{FloatingPoint}, x::Int16) = convert(Float64, x) convert(::Type{FloatingPoint}, x::Int32) = convert(Float64, x) convert(::Type{FloatingPoint}, x::Int64) = convert(Float64, x) # LOSSY convert(::Type{FloatingPoint}, x::Int128) = convert(Float64, x) # LOSSY -convert(::Type{FloatingPoint}, x::Uint8) = convert(Float64, x) -convert(::Type{FloatingPoint}, x::Uint16) = convert(Float64, x) -convert(::Type{FloatingPoint}, x::Uint32) = convert(Float64, x) -convert(::Type{FloatingPoint}, x::Uint64) = convert(Float64, x) # LOSSY -convert(::Type{FloatingPoint}, x::Uint128) = convert(Float64, x) # LOSSY +convert(::Type{FloatingPoint}, x::UInt8) = convert(Float64, x) +convert(::Type{FloatingPoint}, x::UInt16) = convert(Float64, x) +convert(::Type{FloatingPoint}, x::UInt32) = convert(Float64, x) +convert(::Type{FloatingPoint}, x::UInt64) = convert(Float64, x) # LOSSY +convert(::Type{FloatingPoint}, x::UInt128) = convert(Float64, x) # LOSSY float16(x) = convert(Float16, x) float32(x) = convert(Float32, x) @@ -84,7 +84,7 @@ for to in (Int8, Int16, Int32, Int64) end end -for to in (Uint8, Uint16, Uint32, Uint64) +for to in (UInt8, UInt16, UInt32, UInt64) @eval begin iround(::Type{$to}, x::Float32) = box($to,fpuiround($to,unbox(Float32,x))) iround(::Type{$to}, x::Float64) = box($to,fpuiround($to,unbox(Float64,x))) @@ -95,8 +95,8 @@ end iround(::Type{Int128}, x::Float32) = convert(Int128,round(x)) iround(::Type{Int128}, x::Float64) = convert(Int128,round(x)) -iround(::Type{Uint128}, x::Float32) = convert(Uint128,round(x)) -iround(::Type{Uint128}, x::Float64) = convert(Uint128,round(x)) +iround(::Type{UInt128}, x::Float32) = convert(UInt128,round(x)) +iround(::Type{UInt128}, x::Float64) = convert(UInt128,round(x)) # this is needed very early because it is used by Range and colon round(x::Float64) = ccall((:round, Base.libm_name), Float64, (Float64,), x) @@ -178,43 +178,43 @@ function cmp(x::FloatingPoint, y::Real) end ==(x::Float64, y::Int64 ) = eqfsi64(unbox(Float64,x),unbox(Int64,y)) -==(x::Float64, y::Uint64 ) = eqfui64(unbox(Float64,x),unbox(Uint64,y)) +==(x::Float64, y::UInt64 ) = eqfui64(unbox(Float64,x),unbox(UInt64,y)) ==(x::Int64 , y::Float64) = eqfsi64(unbox(Float64,y),unbox(Int64,x)) -==(x::Uint64 , y::Float64) = eqfui64(unbox(Float64,y),unbox(Uint64,x)) +==(x::UInt64 , y::Float64) = eqfui64(unbox(Float64,y),unbox(UInt64,x)) ==(x::Float32, y::Int64 ) = eqfsi64(unbox(Float32,x),unbox(Int64,y)) -==(x::Float32, y::Uint64 ) = eqfui64(unbox(Float32,x),unbox(Uint64,y)) +==(x::Float32, y::UInt64 ) = eqfui64(unbox(Float32,x),unbox(UInt64,y)) ==(x::Int64 , y::Float32) = eqfsi64(unbox(Float32,y),unbox(Int64,x)) -==(x::Uint64 , y::Float32) = eqfui64(unbox(Float32,y),unbox(Uint64,x)) +==(x::UInt64 , y::Float32) = eqfui64(unbox(Float32,y),unbox(UInt64,x)) < (x::Float64, y::Int64 ) = ltfsi64(unbox(Float64,x),unbox(Int64,y)) -< (x::Float64, y::Uint64 ) = ltfui64(unbox(Float64,x),unbox(Uint64,y)) +< (x::Float64, y::UInt64 ) = ltfui64(unbox(Float64,x),unbox(UInt64,y)) < (x::Int64 , y::Float64) = ltsif64(unbox(Int64,x),unbox(Float64,y)) -< (x::Uint64 , y::Float64) = ltuif64(unbox(Uint64,x),unbox(Float64,y)) +< (x::UInt64 , y::Float64) = ltuif64(unbox(UInt64,x),unbox(Float64,y)) < (x::Float32, y::Int64 ) = ltfsi64(unbox(Float64,float64(x)),unbox(Int64,y)) -< (x::Float32, y::Uint64 ) = ltfui64(unbox(Float64,float64(x)),unbox(Uint64,y)) +< (x::Float32, y::UInt64 ) = ltfui64(unbox(Float64,float64(x)),unbox(UInt64,y)) < (x::Int64 , y::Float32) = ltsif64(unbox(Int64,x),unbox(Float64,float64(y))) -< (x::Uint64 , y::Float32) = ltuif64(unbox(Uint64,x),unbox(Float64,float64(y))) +< (x::UInt64 , y::Float32) = ltuif64(unbox(UInt64,x),unbox(Float64,float64(y))) <=(x::Float64, y::Int64 ) = lefsi64(unbox(Float64,x),unbox(Int64,y)) -<=(x::Float64, y::Uint64 ) = lefui64(unbox(Float64,x),unbox(Uint64,y)) +<=(x::Float64, y::UInt64 ) = lefui64(unbox(Float64,x),unbox(UInt64,y)) <=(x::Int64 , y::Float64) = lesif64(unbox(Int64,x),unbox(Float64,y)) -<=(x::Uint64 , y::Float64) = leuif64(unbox(Uint64,x),unbox(Float64,y)) +<=(x::UInt64 , y::Float64) = leuif64(unbox(UInt64,x),unbox(Float64,y)) <=(x::Float32, y::Int64 ) = lefsi64(unbox(Float64,float64(x)),unbox(Int64,y)) -<=(x::Float32, y::Uint64 ) = lefui64(unbox(Float64,float64(x)),unbox(Uint64,y)) +<=(x::Float32, y::UInt64 ) = lefui64(unbox(Float64,float64(x)),unbox(UInt64,y)) <=(x::Int64 , y::Float32) = lesif64(unbox(Int64,x),unbox(Float64,float64(y))) -<=(x::Uint64 , y::Float32) = leuif64(unbox(Uint64,x),unbox(Float64,float64(y))) +<=(x::UInt64 , y::Float32) = leuif64(unbox(UInt64,x),unbox(Float64,float64(y))) -==(x::Float32, y::Union(Int32,Uint32)) = float64(x)==float64(y) -==(x::Union(Int32,Uint32), y::Float32) = float64(x)==float64(y) +==(x::Float32, y::Union(Int32,UInt32)) = float64(x)==float64(y) +==(x::Union(Int32,UInt32), y::Float32) = float64(x)==float64(y) -<(x::Float32, y::Union(Int32,Uint32)) = float64(x)= realmin(x) ? ldexp(eps(typeof(x)),exponent(x)) : nextfloat(zero(x)) : oftype(x,NaN) - eps(::Type{Float16}) = $(box(Float16,unbox(Uint16,0x1400))) - eps(::Type{Float32}) = $(box(Float32,unbox(Uint32,0x34000000))) - eps(::Type{Float64}) = $(box(Float64,unbox(Uint64,0x3cb0000000000000))) + eps(::Type{Float16}) = $(box(Float16,unbox(UInt16,0x1400))) + eps(::Type{Float32}) = $(box(Float32,unbox(UInt32,0x34000000))) + eps(::Type{Float64}) = $(box(Float64,unbox(UInt64,0x3cb0000000000000))) eps() = eps(Float64) end diff --git a/base/float16.jl b/base/float16.jl index 4eb5f287eb1bc..5ae9f625e0a66 100644 --- a/base/float16.jl +++ b/base/float16.jl @@ -1,9 +1,9 @@ function convert(::Type{Float32}, val::Float16) - ival::Uint32 = reinterpret(Uint16, val) - sign::Uint32 = (ival & 0x8000) >> 15 - exp::Uint32 = (ival & 0x7c00) >> 10 - sig::Uint32 = (ival & 0x3ff) >> 0 - ret::Uint32 + ival::UInt32 = reinterpret(UInt16, val) + sign::UInt32 = (ival & 0x8000) >> 15 + exp::UInt32 = (ival & 0x7c00) >> 10 + sig::UInt32 = (ival & 0x3ff) >> 0 + ret::UInt32 if exp == 0 if sig == 0 @@ -44,8 +44,8 @@ end # "Fast Half Float Conversion" by Jeroen van der Zijp # ftp://ftp.fox-toolkit.org/pub/fasthalffloatconversion.pdf -const basetable = Array(Uint16, 512) -const shifttable = Array(Uint8, 512) +const basetable = Array(UInt16, 512) +const shifttable = Array(UInt8, 512) for i = 0:255 e = i - 127 @@ -78,11 +78,11 @@ for i = 0:255 end function convert(::Type{Float16}, val::Float32) - f = reinterpret(Uint32, val) + f = reinterpret(UInt32, val) i = (f >> 23) & 0x1ff + 1 sh = shifttable[i] f &= 0x007fffff - h::Uint16 = uint16(basetable[i] + (f >> sh)) + h::UInt16 = uint16(basetable[i] + (f >> sh)) # round # NOTE: we maybe should ignore NaNs here, but the payload is # getting truncated anyway so "rounding" it might not matter @@ -98,7 +98,7 @@ end convert(::Type{Bool}, x::Float16) = (x!=0) convert(::Type{Int128}, x::Float16) = convert(Int128, float32(x)) -convert(::Type{Uint128}, x::Float16) = convert(Uint128, float32(x)) +convert(::Type{UInt128}, x::Float16) = convert(UInt128, float32(x)) convert{T<:Integer}(::Type{T}, x::Float16) = convert(T, float32(x)) @@ -110,13 +110,13 @@ trunc(x::Float16) = float16(trunc(float32(x))) floor(x::Float16) = float16(floor(float32(x))) ceil(x::Float16) = float16( ceil(float32(x))) -isnan(x::Float16) = reinterpret(Uint16,x)&0x7fff > 0x7c00 -isinf(x::Float16) = reinterpret(Uint16,x)&0x7fff == 0x7c00 -isfinite(x::Float16) = reinterpret(Uint16,x)&0x7c00 != 0x7c00 +isnan(x::Float16) = reinterpret(UInt16,x)&0x7fff > 0x7c00 +isinf(x::Float16) = reinterpret(UInt16,x)&0x7fff == 0x7c00 +isfinite(x::Float16) = reinterpret(UInt16,x)&0x7c00 != 0x7c00 function ==(x::Float16, y::Float16) - ix = reinterpret(Uint16,x) - iy = reinterpret(Uint16,y) + ix = reinterpret(UInt16,x) + iy = reinterpret(UInt16,y) if (ix|iy)&0x7fff > 0x7c00 #isnan(x) || isnan(y) return false end @@ -126,8 +126,8 @@ function ==(x::Float16, y::Float16) return ix == iy end --(x::Float16) = reinterpret(Float16, reinterpret(Uint16,x) $ 0x8000) -abs(x::Float16) = reinterpret(Float16, reinterpret(Uint16,x) & 0x7fff) +-(x::Float16) = reinterpret(Float16, reinterpret(UInt16,x) $ 0x8000) +abs(x::Float16) = reinterpret(Float16, reinterpret(UInt16,x) & 0x7fff) for op in (:+,:-,:*,:/,:\,:^) @eval ($op)(a::Float16, b::Float16) = float16(($op)(float32(a), float32(b))) end diff --git a/base/floatfuncs.jl b/base/floatfuncs.jl index fe64c14707d6c..25efe7168046c 100644 --- a/base/floatfuncs.jl +++ b/base/floatfuncs.jl @@ -24,9 +24,9 @@ maxintfloat() = maxintfloat(Float64) isinteger(x::FloatingPoint) = (trunc(x)==x)&isfinite(x) -num2hex(x::Float16) = hex(reinterpret(Uint16,x), 4) -num2hex(x::Float32) = hex(box(Uint32,unbox(Float32,x)),8) -num2hex(x::Float64) = hex(box(Uint64,unbox(Float64,x)),16) +num2hex(x::Float16) = hex(reinterpret(UInt16,x), 4) +num2hex(x::Float32) = hex(box(UInt32,unbox(Float32,x)),8) +num2hex(x::Float64) = hex(box(UInt64,unbox(Float64,x)),16) function hex2num(s::AbstractString) if length(s) <= 8 diff --git a/base/fs.jl b/base/fs.jl index 12712beeba684..f389ee226d530 100644 --- a/base/fs.jl +++ b/base/fs.jl @@ -70,7 +70,7 @@ _uv_fs_result(req) = ccall(:jl_uv_fs_result,Int32,(Ptr{Void},),req) function open(f::File,flags::Integer,mode::Integer) req = c_malloc(_sizeof_uv_fs) - ret = ccall(:uv_fs_open,Int32,(Ptr{Void},Ptr{Void},Ptr{Uint8},Int32,Int32,Ptr{Void}), + ret = ccall(:uv_fs_open,Int32,(Ptr{Void},Ptr{Void},Ptr{UInt8},Int32,Int32,Ptr{Void}), eventloop(), req, f.path, flags,mode, C_NULL) f.handle = _uv_fs_result(req) ccall(:uv_fs_req_cleanup,Void,(Ptr{Void},),req) @@ -94,7 +94,7 @@ function close(f::File) end function unlink(p::AbstractString) - err = ccall(:jl_fs_unlink, Int32, (Ptr{Uint8},), p) + err = ccall(:jl_fs_unlink, Int32, (Ptr{UInt8},), p) uv_error("unlink",err) end function unlink(f::File) @@ -110,7 +110,7 @@ end # For move command function rename(src::AbstractString, dst::AbstractString) - err = ccall(:jl_fs_rename, Int32, (Ptr{Uint8}, Ptr{Uint8}), src, dst) + err = ccall(:jl_fs_rename, Int32, (Ptr{UInt8}, Ptr{UInt8}), src, dst) # on error, default to cp && rm if err < 0 @@ -153,7 +153,7 @@ end @non_windowsxp_only function symlink(p::AbstractString, np::AbstractString) flags = 0 @windows_only if isdir(p); flags |= UV_FS_SYMLINK_JUNCTION; p = abspath(p); end - err = ccall(:jl_fs_symlink, Int32, (Ptr{Uint8}, Ptr{Uint8}, Cint), p, np, flags) + err = ccall(:jl_fs_symlink, Int32, (Ptr{UInt8}, Ptr{UInt8}, Cint), p, np, flags) @windows_only if err < 0 Base.warn_once("Note: on Windows, creating file symlinks requires Administrator privileges.") end @@ -163,21 +163,21 @@ end error("WindowsXP does not support soft symlinks") function chmod(p::AbstractString, mode::Integer) - err = ccall(:jl_fs_chmod, Int32, (Ptr{Uint8}, Cint), p, mode) + err = ccall(:jl_fs_chmod, Int32, (Ptr{UInt8}, Cint), p, mode) uv_error("chmod",err) end -function write(f::File, buf::Ptr{Uint8}, len::Integer, offset::Integer=-1) +function write(f::File, buf::Ptr{UInt8}, len::Integer, offset::Integer=-1) if !f.open error("file is not open") end - err = ccall(:jl_fs_write, Int32, (Int32, Ptr{Uint8}, Csize_t, Csize_t), + err = ccall(:jl_fs_write, Int32, (Int32, Ptr{UInt8}, Csize_t, Csize_t), f.handle, buf, len, offset) uv_error("write",err) len end -function write(f::File, c::Uint8) +function write(f::File, c::UInt8) if !f.open error("file is not open") end @@ -212,7 +212,7 @@ function futime(f::File, atime::Float64, mtime::Float64) f end -function read(f::File, ::Type{Uint8}) +function read(f::File, ::Type{UInt8}) if !f.open error("file is not open") end @@ -238,7 +238,7 @@ end nb_available(f::File) = filesize(f) - position(f) -function readbytes!(f::File, b::Array{Uint8}, nb=length(b)) +function readbytes!(f::File, b::Array{UInt8}, nb=length(b)) nr = min(nb, nb_available(f)) if length(b) < nr resize!(b, nr) @@ -246,11 +246,11 @@ function readbytes!(f::File, b::Array{Uint8}, nb=length(b)) read!(f, b, nr) return nr end -readbytes(io::File) = read!(io, Array(Uint8, nb_available(io))) -readbytes(io::File, nb) = read!(io, Array(Uint8, min(nb, nb_available(io)))) +readbytes(io::File) = read!(io, Array(UInt8, nb_available(io))) +readbytes(io::File, nb) = read!(io, Array(UInt8, min(nb, nb_available(io)))) function readbytes(f::File) - a = Array(Uint8, nb_available(f)) + a = Array(UInt8, nb_available(f)) read!(f,a) a end diff --git a/base/gmp.jl b/base/gmp.jl index d60bec73229ae..e648ca3ad37cb 100644 --- a/base/gmp.jl +++ b/base/gmp.jl @@ -11,10 +11,10 @@ import Base: *, +, -, /, <, <<, >>, >>>, <=, ==, >, >=, ^, (~), (&), (|), ($), if Clong == Int32 typealias ClongMax Union(Int8, Int16, Int32) - typealias CulongMax Union(Uint8, Uint16, Uint32) + typealias CulongMax Union(UInt8, UInt16, UInt32) else typealias ClongMax Union(Int8, Int16, Int32, Int64) - typealias CulongMax Union(Uint8, Uint16, Uint32, Uint64) + typealias CulongMax Union(UInt8, UInt16, UInt32, UInt64) end typealias CdoubleMax Union(Float16, Float32, Float64) @@ -44,7 +44,7 @@ function __init__() end widen(::Type{Int128}) = BigInt -widen(::Type{Uint128}) = BigInt +widen(::Type{UInt128}) = BigInt widen(::Type{BigInt}) = BigInt BigInt(x::BigInt) = x @@ -55,8 +55,8 @@ function Base.parseint_nocheck(::Type{BigInt}, s::AbstractString, base::Int) sgn, base, i = Base.parseint_preamble(true,s,base) z = BigInt() err = ccall((:__gmpz_set_str, :libgmp), - Int32, (Ptr{BigInt}, Ptr{Uint8}, Int32), - &z, convert(Ptr{Uint8},SubString(s,i)), base) + Int32, (Ptr{BigInt}, Ptr{UInt8}, Int32), + &z, convert(Ptr{UInt8},SubString(s,i)), base) err == 0 || error("invalid big integer: $(repr(s))") return sgn < 0 ? -z : z end @@ -66,7 +66,7 @@ function BigInt(x::Union(Clong,Int32)) ccall((:__gmpz_set_si, :libgmp), Void, (Ptr{BigInt}, Clong), &z, x) return z end -function BigInt(x::Union(Culong,Uint32)) +function BigInt(x::Union(Culong,UInt32)) z = BigInt() ccall((:__gmpz_set_ui, :libgmp), Void, (Ptr{BigInt}, Culong), &z, x) return z @@ -116,7 +116,7 @@ convert(::Type{BigInt}, x::Float16) = BigInt(x) convert(::Type{BigInt}, x::FloatingPoint) = BigInt(x) function convert(::Type{Int64}, x::BigInt) - lo = int64(convert(Culong, x & typemax(Uint32))) + lo = int64(convert(Culong, x & typemax(UInt32))) hi = int64(convert(Clong, x >> 32)) hi << 32 | lo end @@ -133,14 +133,14 @@ function convert(::Type{Clong}, n::BigInt) end end -function convert(::Type{Uint64}, x::BigInt) - lo = uint64(convert(Culong, x & typemax(Uint32))) +function convert(::Type{UInt64}, x::BigInt) + lo = uint64(convert(Culong, x & typemax(UInt32))) hi = uint64(convert(Culong, x >> 32)) hi << 32 | lo end -convert(::Type{Uint32}, x::BigInt) = uint32(convert(Culong, x)) -convert(::Type{Uint16}, x::BigInt) = uint16(convert(Culong, x)) -convert(::Type{Uint8}, x::BigInt) = uint8(convert(Culong, x)) +convert(::Type{UInt32}, x::BigInt) = uint32(convert(Culong, x)) +convert(::Type{UInt16}, x::BigInt) = uint16(convert(Culong, x)) +convert(::Type{UInt8}, x::BigInt) = uint8(convert(Culong, x)) function convert(::Type{Culong}, n::BigInt) fits = ccall((:__gmpz_fits_ulong_p, :libgmp), Int32, (Ptr{BigInt},), &n) != 0 @@ -152,17 +152,17 @@ function convert(::Type{Culong}, n::BigInt) end if sizeof(Int32) == sizeof(Clong) - function convert(::Type{Uint128}, x::BigInt) + function convert(::Type{UInt128}, x::BigInt) uint128(uint(x>>>96))<<96 + - uint128(uint((x>>>64) & typemax(Uint32)))<<64 + - uint128(uint((x>>>32) & typemax(Uint32)))<<32 + - uint128(uint(x & typemax(Uint32))) + uint128(uint((x>>>64) & typemax(UInt32)))<<64 + + uint128(uint((x>>>32) & typemax(UInt32)))<<32 + + uint128(uint(x & typemax(UInt32))) end end if sizeof(Int64) == sizeof(Clong) - function convert(::Type{Uint128}, x::BigInt) + function convert(::Type{UInt128}, x::BigInt) uint128(uint(x>>>64))<<64 + - uint128(uint(x & typemax(Uint64))) + uint128(uint(x & typemax(UInt64))) end end convert(::Type{Int128}, x::BigInt) = copysign(int128(uint128(abs(x))),x) @@ -339,7 +339,7 @@ function isqrt(x::BigInt) return z end -function ^(x::BigInt, y::Uint) +function ^(x::BigInt, y::UInt) z = BigInt() ccall((:__gmpz_pow_ui, :libgmp), Void, (Ptr{BigInt}, Ptr{BigInt}, Culong), &z, &x, y) return z @@ -349,7 +349,7 @@ function bigint_pow(x::BigInt, y::Integer) if y<0; throw(DomainError()); end if x== 1; return x; end if x==-1; return isodd(y) ? x : -x; end - if y>typemax(Uint); throw(DomainError()); end + if y>typemax(UInt); throw(DomainError()); end return x^uint(y) end @@ -407,7 +407,7 @@ function factorial(x::BigInt) return z end -function binomial(n::BigInt, k::Uint) +function binomial(n::BigInt, k::UInt) z = BigInt() ccall((:__gmpz_bin_ui, :libgmp), Void, (Ptr{BigInt}, Ptr{BigInt}, Culong), &z, &n, k) return z @@ -442,8 +442,8 @@ hex(n::BigInt) = base(16, n) function base(b::Integer, n::BigInt) 2 <= b <= 62 || error("invalid base: $b") - p = ccall((:__gmpz_get_str,:libgmp), Ptr{Uint8}, (Ptr{Uint8}, Cint, Ptr{BigInt}), C_NULL, b, &n) - len = int(ccall(:strlen, Csize_t, (Ptr{Uint8},), p)) + p = ccall((:__gmpz_get_str,:libgmp), Ptr{UInt8}, (Ptr{UInt8}, Cint, Ptr{BigInt}), C_NULL, b, &n) + len = int(ccall(:strlen, Csize_t, (Ptr{UInt8},), p)) ASCIIString(pointer_to_array(p,len,true)) end @@ -472,8 +472,8 @@ ndigits(x::BigInt, b::Integer=10) = x.size == 0 ? 1 : ndigits0z(x,b) isprime(x::BigInt, reps=25) = ccall((:__gmpz_probab_prime_p,:libgmp), Cint, (Ptr{BigInt}, Cint), &x, reps) > 0 -widemul(x::Int128, y::Uint128) = BigInt(x)*BigInt(y) -widemul(x::Uint128, y::Int128) = BigInt(x)*BigInt(y) +widemul(x::Int128, y::UInt128) = BigInt(x)*BigInt(y) +widemul(x::UInt128, y::Int128) = BigInt(x)*BigInt(y) prevpow2(x::BigInt) = x.size < 0 ? -prevpow2(-x) : (x <= 2 ? x : one(BigInt) << (ndigits(x, 2)-1)) nextpow2(x::BigInt) = x.size < 0 ? -nextpow2(-x) : (x <= 2 ? x : one(BigInt) << ndigits(x-1, 2)) diff --git a/base/grisu.jl b/base/grisu.jl index 9e1b61d078c1a..32d2712de0423 100644 --- a/base/grisu.jl +++ b/base/grisu.jl @@ -7,7 +7,7 @@ const SHORTEST = 1 const FIXED = 2 const PRECISION = 3 -const DIGITS = Array(Uint8,309+17) +const DIGITS = Array(UInt8,309+17) include("grisu/float.jl") include("grisu/fastshortest.jl") diff --git a/base/grisu/bignum.jl b/base/grisu/bignum.jl index 52cc6b8ae06bf..eb8175aee5f76 100644 --- a/base/grisu/bignum.jl +++ b/base/grisu/bignum.jl @@ -1,5 +1,5 @@ function normalizedexponent(significand, exponent::Int32) - significand::Uint64 + significand::UInt64 while (significand & HiddenBit(Float64)) == 0 significand <<= 1 exponent -= 1 diff --git a/base/grisu/fastfixed.jl b/base/grisu/fastfixed.jl index 22bd4e4e68f54..b27efb8f03c3c 100644 --- a/base/grisu/fastfixed.jl +++ b/base/grisu/fastfixed.jl @@ -112,7 +112,7 @@ end low(x) = uint64(x&0xffffffffffffffff) high(x) = uint64(x >>> 64) -bitat(x::Uint128,y) = y >= 64 ? (int32(high(x) >> (y-64)) & 1) : (int32(low(x) >> y) & 1) +bitat(x::UInt128,y) = y >= 64 ? (int32(high(x) >> (y-64)) & 1) : (int32(low(x) >> y) & 1) function divrem2(x,power) h = high(x) l = low(x) @@ -121,13 +121,13 @@ function divrem2(x,power) h -= uint64(result) << (power - 64) return result, (uint128(h) << 64) + l else - part_low::Uint64 = l >> power - part_high::Uint64 = h << (64 - power) + part_low::UInt64 = l >> power + part_high::UInt64 = h << (64 - power) result = int32(part_low + part_high) return result, uint128(l - (part_low << power)) end end -function shift(x::Uint128,amt) +function shift(x::UInt128,amt) if amt == 0 return x elseif amt == -64 @@ -169,7 +169,7 @@ end function fastfixedtoa(v,mode,fractional_count,buffer) v = float64(v) - significand::Uint64 = _significand(v) + significand::UInt64 = _significand(v) exponent = _exponent(v) exponent > 20 && return false, 0, 0, buffer fractional_count > 20 && return false, 0, 0, buffer diff --git a/base/grisu/fastprecision.jl b/base/grisu/fastprecision.jl index c8235b8355392..03db265d29b48 100644 --- a/base/grisu/fastprecision.jl +++ b/base/grisu/fastprecision.jl @@ -19,7 +19,7 @@ function roundweed(buffer,len,rest,tk,unit,kappa) end function digitgen(w,buffer,requested_digits=1000) - unit::Uint64 = 1 + unit::UInt64 = 1 one = Float(unit << -w.e, w.e) integrals = w.s >> -one.e fractionals = w.s & (one.s-1) @@ -57,7 +57,7 @@ function digitgen(w,buffer,requested_digits=1000) return r, kappa, len end -function fastprecision(v,requested_digits,buffer=Array(Uint8,100)) +function fastprecision(v,requested_digits,buffer=Array(UInt8,100)) f = normalize(float64(v)) ten_mk_min_exp = kMinExp - (f.e + FloatSignificandSize) ten_mk_max_exp = kMaxExp - (f.e + FloatSignificandSize) diff --git a/base/grisu/fastshortest.jl b/base/grisu/fastshortest.jl index e6d1151817de8..4059d74ec8a78 100644 --- a/base/grisu/fastshortest.jl +++ b/base/grisu/fastshortest.jl @@ -1,7 +1,7 @@ const kMinExp = -60 const kMaxExp = -32 -function roundweed(buffer,len,rest,tk,unit,kappa,too_high::Uint64,unsafe_interval::Uint64) +function roundweed(buffer,len,rest,tk,unit,kappa,too_high::UInt64,unsafe_interval::UInt64) small = too_high - unit big = too_high + unit while rest < small && @@ -32,7 +32,7 @@ function bigpowten(n,n_bits) end function digitgen(low,w,high,buffer) - unit::Uint64 = 1 + unit::UInt64 = 1 one = Float(unit << -w.e, w.e) too_high = Float(high.s+unit,high.e) unsafe_interval = too_high - Float(low.s-unit,low.e) @@ -72,7 +72,7 @@ function digitgen(low,w,high,buffer) end end -function fastshortest(v,buffer=Array(Uint8,17)) +function fastshortest(v,buffer=Array(UInt8,17)) f = normalize(float64(v)) bound_minus, bound_plus = normalizedbound(v) ten_mk_min_exp = kMinExp - (f.e + FloatSignificandSize) diff --git a/base/grisu/float.jl b/base/grisu/float.jl index 3f9673f4bf039..f84a7c641ca52 100644 --- a/base/grisu/float.jl +++ b/base/grisu/float.jl @@ -1,5 +1,5 @@ immutable Float - s::Uint64 + s::UInt64 e::Int32 de::Int32 end @@ -45,7 +45,7 @@ end #ExponentBias(::Type{Float128}) = int32(0x00003fff + PhysicalSignificandSize(Float128)) #SignificandMask(::Type{Float128}) = 0x0000ffffffffffffffffffffffffffff #HiddenBit(::Type{Float128}) = 0x00010000000000000000000000000000 -#uint_t(d::Float128) = reinterpret(Uint128,d) +#uint_t(d::Float128) = reinterpret(UInt128,d) # Float64 DenormalExponent(::Type{Float64}) = int32(-ExponentBias(Float64) + 1) ExponentMask(::Type{Float64}) = 0x7FF0000000000000 @@ -54,7 +54,7 @@ SignificandSize(::Type{Float64}) = int32(53) ExponentBias(::Type{Float64}) = int32(0x3FF + PhysicalSignificandSize(Float64)) SignificandMask(::Type{Float64}) = 0x000FFFFFFFFFFFFF HiddenBit(::Type{Float64}) = 0x0010000000000000 -uint_t(d::Float64) = reinterpret(Uint64,d) +uint_t(d::Float64) = reinterpret(UInt64,d) # Float32 DenormalExponent(::Type{Float32}) = int32(-ExponentBias(Float32) + 1) ExponentMask(::Type{Float32}) = 0x7F800000 @@ -63,7 +63,7 @@ SignificandSize(::Type{Float32}) = int32(24) ExponentBias(::Type{Float32}) = int32(0x7F + PhysicalSignificandSize(Float32)) SignificandMask(::Type{Float32}) = 0x007FFFFF HiddenBit(::Type{Float32}) = 0x00800000 -uint_t(d::Float32) = reinterpret(Uint32,d) +uint_t(d::Float32) = reinterpret(UInt32,d) # Float16 DenormalExponent(::Type{Float16}) = int32(-ExponentBias(Float16) + 1) ExponentMask(::Type{Float16}) = 0x7c00 @@ -72,7 +72,7 @@ SignificandSize(::Type{Float16}) = int32(11) ExponentBias(::Type{Float16}) = int32(0x000f + PhysicalSignificandSize(Float16)) SignificandMask(::Type{Float16}) = 0x03ff HiddenBit(::Type{Float16}) = 0x0400 -uint_t(d::Float16) = reinterpret(Uint16,d) +uint_t(d::Float16) = reinterpret(UInt16,d) function _exponent{T<:FloatingPoint}(d::T) isdenormal(d) && return DenormalExponent(T) @@ -105,19 +105,19 @@ end const FloatM32 = 0xFFFFFFFF function (*)(this::Float,other::Float) - a::Uint64 = this.s >> 32 - b::Uint64 = this.s & FloatM32 - c::Uint64 = other.s >> 32 - d::Uint64 = other.s & FloatM32 - ac::Uint64 = a * c - bc::Uint64 = b * c - ad::Uint64 = a * d - bd::Uint64 = b * d - tmp::Uint64 = (bd >> 32) + (ad & FloatM32) + (bc & FloatM32) + a::UInt64 = this.s >> 32 + b::UInt64 = this.s & FloatM32 + c::UInt64 = other.s >> 32 + d::UInt64 = other.s & FloatM32 + ac::UInt64 = a * c + bc::UInt64 = b * c + ad::UInt64 = a * d + bd::UInt64 = b * d + tmp::UInt64 = (bd >> 32) + (ad & FloatM32) + (bc & FloatM32) # By adding 1U << 31 to tmp we round the final result. # Halfway cases will be round up. tmp += uint64(1) << 31 - result_f::Uint64 = ac + (ad >> 32) + (bc >> 32) + (tmp >> 32) + result_f::UInt64 = ac + (ad >> 32) + (bc >> 32) + (tmp >> 32) return Float(result_f,this.e + other.e + 64,this.de) end diff --git a/base/hashing.jl b/base/hashing.jl index 6ef396328b983..8bb61e97d7901 100644 --- a/base/hashing.jl +++ b/base/hashing.jl @@ -1,16 +1,16 @@ ## hashing a single value ## -hash(x::Any) = hash(x, zero(Uint)) -hash(w::WeakRef, h::Uint) = hash(w.value, h) +hash(x::Any) = hash(x, zero(UInt)) +hash(w::WeakRef, h::UInt) = hash(w.value, h) ## hashing general objects ## -hash(x::ANY, h::Uint) = hash(object_id(x), h) +hash(x::ANY, h::UInt) = hash(object_id(x), h) ## core data hashing functions ## -function hash_64_64(n::Uint64) - local a::Uint64 = n +function hash_64_64(n::UInt64) + local a::UInt64 = n a = ~a + a << 21 a = a $ a >> 24 a = a + a << 3 + a << 8 @@ -21,19 +21,19 @@ function hash_64_64(n::Uint64) return a end -function hash_64_32(n::Uint64) - local a::Uint64 = n +function hash_64_32(n::UInt64) + local a::UInt64 = n a = ~a + a << 18 a = a $ a >> 31 a = a * 21 a = a $ a >> 11 a = a + a << 6 a = a $ a >> 22 - return a % Uint32 + return a % UInt32 end -function hash_32_32(n::Uint32) - local a::Uint32 = n +function hash_32_32(n::UInt32) + local a::UInt32 = n a = a + 0x7ed55d16 + a << 12 a = a $ 0xc761c23c $ a >> 19 a = a + 0x165667b1 + a << 5 @@ -43,36 +43,36 @@ function hash_32_32(n::Uint32) return a end -if Uint === Uint64 - hash_uint64(x::Uint64) = hash_64_64(x) - hash_uint(x::Uint) = hash_64_64(x) +if UInt === UInt64 + hash_uint64(x::UInt64) = hash_64_64(x) + hash_uint(x::UInt) = hash_64_64(x) else - hash_uint64(x::Uint64) = hash_64_32(x) - hash_uint(x::Uint) = hash_32_32(x) + hash_uint64(x::UInt64) = hash_64_32(x) + hash_uint(x::UInt) = hash_32_32(x) end ## hashing small, built-in numeric types ## -hx(a::Uint64, b::Float64, h::Uint) = hash_uint64((3a + reinterpret(Uint64,b)) - h) +hx(a::UInt64, b::Float64, h::UInt) = hash_uint64((3a + reinterpret(UInt64,b)) - h) const hx_NaN = hx(uint64(0), NaN, uint(0 )) -hash(x::Uint64, h::Uint) = hx(x, float64(x), h) -hash(x::Int64, h::Uint) = hx(reinterpret(Uint64,abs(x)), float64(x), h) -hash(x::Float64, h::Uint) = isnan(x) ? (hx_NaN $ h) : hx(box(Uint64,fptoui(unbox(Float64,abs(x)))), x, h) +hash(x::UInt64, h::UInt) = hx(x, float64(x), h) +hash(x::Int64, h::UInt) = hx(reinterpret(UInt64,abs(x)), float64(x), h) +hash(x::Float64, h::UInt) = isnan(x) ? (hx_NaN $ h) : hx(box(UInt64,fptoui(unbox(Float64,abs(x)))), x, h) -hash(x::Union(Bool,Char,Int8,Uint8,Int16,Uint16,Int32,Uint32), h::Uint) = hash(int64(x), h) -hash(x::Float32, h::Uint) = hash(float64(x), h) +hash(x::Union(Bool,Char,Int8,UInt8,Int16,UInt16,Int32,UInt32), h::UInt) = hash(int64(x), h) +hash(x::Float32, h::UInt) = hash(float64(x), h) ## hashing complex numbers ## -if Uint === Uint64 +if UInt === UInt64 const h_imag = 0x32a7a07f3e7cd1f9 else const h_imag = 0x3e7cd1f9 end const hash_0_imag = hash(0, h_imag) -function hash(z::Complex, h::Uint) +function hash(z::Complex, h::UInt) # TODO: with default argument specialization, this would be better: # hash(real(z), h $ hash(imag(z), h $ h_imag) $ hash(0, h $ h_imag)) hash(real(z), h $ hash(imag(z), h_imag) $ hash_0_imag) @@ -80,9 +80,9 @@ end ## symbol & expression hashing ## -hash(x::Symbol, h::Uint) = hash(object_id(x), h) -if Uint === Uint64 - hash(x::Expr, h::Uint) = hash(x.args, hash(x.head, h + 0x83c7900696d26dc6)) +hash(x::Symbol, h::UInt) = hash(object_id(x), h) +if UInt === UInt64 + hash(x::Expr, h::UInt) = hash(x.args, hash(x.head, h + 0x83c7900696d26dc6)) else - hash(x::Expr, h::Uint) = hash(x.args, hash(x.head, h + 0x96d26dc6)) + hash(x::Expr, h::UInt) = hash(x.args, hash(x.head, h + 0x96d26dc6)) end diff --git a/base/hashing2.jl b/base/hashing2.jl index ed2ebc3e89530..b28562b995ace 100644 --- a/base/hashing2.jl +++ b/base/hashing2.jl @@ -1,20 +1,20 @@ ## efficient value-based hashing of integers ## -function hash_integer(n::Integer, h::Uint) - h = hash_uint(uint(n & typemax(Uint)) $ h) $ h +function hash_integer(n::Integer, h::UInt) + h = hash_uint(uint(n & typemax(UInt)) $ h) $ h n = ifelse(n < 0, oftype(n,-n), n) - n >>>= sizeof(Uint) << 3 + n >>>= sizeof(UInt) << 3 while n != 0 - h = hash_uint(uint(n & typemax(Uint)) $ h) $ h - n >>>= sizeof(Uint) << 3 + h = hash_uint(uint(n & typemax(UInt)) $ h) $ h + n >>>= sizeof(UInt) << 3 end return h end -function hash_integer(n::BigInt, h::Uint) +function hash_integer(n::BigInt, h::UInt) s = n.size s == 0 && return hash_integer(0, h) - p = convert(Ptr{Uint}, n.d) + p = convert(Ptr{UInt}, n.d) b = unsafe_load(p) h = hash_uint(ifelse(s < 0, -b, b) $ h) $ h for k = 2:abs(s) @@ -25,7 +25,7 @@ end ## generic hashing for rational values ## -function hash(x::Real, h::Uint) +function hash(x::Real, h::UInt) # decompose x as num*2^pow/den num, pow, den = decompose(x) @@ -50,7 +50,7 @@ function hash(x::Real, h::Uint) pow -= z end - # handle values representable as Int64, Uint64, Float64 + # handle values representable as Int64, UInt64, Float64 if den == 1 left = ndigits0z(num,2) + pow right = trailing_zeros(num) + pow @@ -129,7 +129,7 @@ end ## streamlined hashing for smallish rational types ## -function hash{T<:Integer64}(x::Rational{T}, h::Uint) +function hash{T<:Integer64}(x::Rational{T}, h::UInt) num, den = Base.num(x), Base.den(x) den == 1 && return hash(num, h) den == 0 && return hash(ifelse(num > 0, Inf, -Inf), h) @@ -152,11 +152,11 @@ end ## hashing Float16s ## -hash(x::Float16, h::Uint) = hash(float64(x), h) +hash(x::Float16, h::UInt) = hash(float64(x), h) ## hashing collections ## -const hashaa_seed = Uint === Uint64 ? 0x7f53e68ceb575e76 : 0xeb575e76 -function hash(a::AbstractArray, h::Uint) +const hashaa_seed = UInt === UInt64 ? 0x7f53e68ceb575e76 : 0xeb575e76 +function hash(a::AbstractArray, h::UInt) h += hashaa_seed h += hash(size(a)) for x in a @@ -165,8 +165,8 @@ function hash(a::AbstractArray, h::Uint) return h end -const hasha_seed = Uint === Uint64 ? 0x6d35bb51952d5539 : 0x952d5539 -function hash(a::Associative, h::Uint) +const hasha_seed = UInt === UInt64 ? 0x6d35bb51952d5539 : 0x952d5539 +function hash(a::Associative, h::UInt) h += hasha_seed for (k,v) in a h $= hash(k, hash(v)) @@ -174,8 +174,8 @@ function hash(a::Associative, h::Uint) return h end -const hashs_seed = Uint === Uint64 ? 0x852ada37cfe8e0ce : 0xcfe8e0ce -function hash(s::Set, h::Uint) +const hashs_seed = UInt === UInt64 ? 0x852ada37cfe8e0ce : 0xcfe8e0ce +function hash(s::Set, h::UInt) h += hashs_seed for x in s h $= hash(x) @@ -183,8 +183,8 @@ function hash(s::Set, h::Uint) return h end -const hashis_seed = Uint === Uint64 ? 0x88989f1fc7dea67d : 0xc7dea67d -function hash(s::IntSet, h::Uint) +const hashis_seed = UInt === UInt64 ? 0x88989f1fc7dea67d : 0xc7dea67d +function hash(s::IntSet, h::UInt) h += hashis_seed h += hash(s.fill1s) filln = s.fill1s ? ~zero(eltype(s.bits)) : zero(eltype(s.bits)) @@ -197,8 +197,8 @@ function hash(s::IntSet, h::Uint) end # hashing ranges by component at worst leads to collisions for very similar ranges -const hashr_seed = Uint === Uint64 ? 0x80707b6821b70087 : 0x21b70087 -function hash(r::Range, h::Uint) +const hashr_seed = UInt === UInt64 ? 0x80707b6821b70087 : 0x21b70087 +function hash(r::Range, h::UInt) h += hashr_seed h = hash(first(r), h) h = hash(step(r), h) diff --git a/base/int.jl b/base/int.jl index 419aa6f4df036..46b731ad79219 100644 --- a/base/int.jl +++ b/base/int.jl @@ -1,7 +1,7 @@ ## integer arithmetic ## -const IntTypes = (Int8, Uint8, Int16, Uint16, Int32, Uint32, - Int64, Uint64, Int128, Uint128) +const IntTypes = (Int8, UInt8, Int16, UInt16, Int32, UInt32, + Int64, UInt64, Int128, UInt128) +(x::Int, y::Int) = box(Int,add_int(unbox(Int,x),unbox(Int,y))) <(x::Int, y::Int) = slt_int(unbox(Int,x),unbox(Int,y)) @@ -67,7 +67,7 @@ cld(x::Unsigned, y::Signed) = div(x,y)+(!signbit(y)&(rem(x,y)!=0)) # Don't promote integers for div/rem/mod since there no danger of overflow, # while there is a substantial performance penalty to 64-bit promotion. typealias Signed64 Union(Int8,Int16,Int32,Int64) -typealias Unsigned64 Union(Uint8,Uint16,Uint32,Uint64) +typealias Unsigned64 Union(UInt8,UInt16,UInt32,UInt64) typealias Integer64 Union(Signed64,Unsigned64) div{T<:Signed64} (x::T, y::T) = box(T,sdiv_int(unbox(T,x),unbox(T,y))) @@ -105,15 +105,15 @@ for T in IntTypes end bswap(x::Int8) = x -bswap(x::Uint8) = x +bswap(x::UInt8) = x bswap(x::Int16) = box(Int16,bswap_int(unbox(Int16,x))) -bswap(x::Uint16) = box(Uint16,bswap_int(unbox(Uint16,x))) +bswap(x::UInt16) = box(UInt16,bswap_int(unbox(UInt16,x))) bswap(x::Int32) = box(Int32,bswap_int(unbox(Int32,x))) -bswap(x::Uint32) = box(Uint32,bswap_int(unbox(Uint32,x))) +bswap(x::UInt32) = box(UInt32,bswap_int(unbox(UInt32,x))) bswap(x::Int64) = box(Int64,bswap_int(unbox(Int64,x))) -bswap(x::Uint64) = box(Uint64,bswap_int(unbox(Uint64,x))) +bswap(x::UInt64) = box(UInt64,bswap_int(unbox(UInt64,x))) bswap(x::Int128) = box(Int128,bswap_int(unbox(Int128,x))) -bswap(x::Uint128) = box(Uint128,bswap_int(unbox(Uint128,x))) +bswap(x::UInt128) = box(UInt128,bswap_int(unbox(UInt128,x))) for T in IntTypes @eval begin @@ -186,7 +186,7 @@ for to in (Int8, Int16, Int32, Int64) end end -for to in (Uint8, Uint16, Uint32, Uint64) +for to in (UInt8, UInt16, UInt32, UInt64) @eval begin convert(::Type{$to}, x::Float32) = box($to,checked_fptoui($to,unbox(Float32,x))) convert(::Type{$to}, x::Float64) = box($to,checked_fptoui($to,unbox(Float64,x))) @@ -197,39 +197,39 @@ function convert(::Type{Int128}, x::FloatingPoint) ax = abs(x) top = trunc(ldexp(ax,-64)) bot = ax - ldexp(top,64) - n = int128(convert(Uint64,top))<<64 + int128(convert(Uint64,bot)) + n = int128(convert(UInt64,top))<<64 + int128(convert(UInt64,bot)) return x<0 ? -n : n end convert(::Type{Int128}, x::Float32) = convert(Int128, float64(x)) -function convert(::Type{Uint128}, x::FloatingPoint) +function convert(::Type{UInt128}, x::FloatingPoint) ax = abs(x) top = trunc(ldexp(ax,-64)) bot = ax - ldexp(top,64) - n = uint128(convert(Uint64,top))<<64 + uint128(convert(Uint64,bot)) + n = uint128(convert(UInt64,top))<<64 + uint128(convert(UInt64,bot)) return x<0 ? -n : n end -convert(::Type{Uint128}, x::Float32) = convert(Uint128, float64(x)) +convert(::Type{UInt128}, x::Float32) = convert(UInt128, float64(x)) -convert(::Type{Signed}, x::Uint8 ) = convert(Int8,x) -convert(::Type{Signed}, x::Uint16 ) = convert(Int16,x) -convert(::Type{Signed}, x::Uint32 ) = convert(Int32,x) -convert(::Type{Signed}, x::Uint64 ) = convert(Int64,x) -convert(::Type{Signed}, x::Uint128) = convert(Int128,x) +convert(::Type{Signed}, x::UInt8 ) = convert(Int8,x) +convert(::Type{Signed}, x::UInt16 ) = convert(Int16,x) +convert(::Type{Signed}, x::UInt32 ) = convert(Int32,x) +convert(::Type{Signed}, x::UInt64 ) = convert(Int64,x) +convert(::Type{Signed}, x::UInt128) = convert(Int128,x) convert(::Type{Signed}, x::Float32) = convert(Int,x) convert(::Type{Signed}, x::Float64) = convert(Int,x) convert(::Type{Signed}, x::Char) = convert(Int,x) convert(::Type{Signed}, x::Bool) = convert(Int,x) -convert(::Type{Unsigned}, x::Int8 ) = convert(Uint8,x) -convert(::Type{Unsigned}, x::Int16 ) = convert(Uint16,x) -convert(::Type{Unsigned}, x::Int32 ) = convert(Uint32,x) -convert(::Type{Unsigned}, x::Int64 ) = convert(Uint64,x) -convert(::Type{Unsigned}, x::Int128 ) = convert(Uint128,x) -convert(::Type{Unsigned}, x::Float32) = convert(Uint,x) -convert(::Type{Unsigned}, x::Float64) = convert(Uint,x) -convert(::Type{Unsigned}, x::Char) = convert(Uint,x) -convert(::Type{Unsigned}, x::Bool) = convert(Uint,x) +convert(::Type{Unsigned}, x::Int8 ) = convert(UInt8,x) +convert(::Type{Unsigned}, x::Int16 ) = convert(UInt16,x) +convert(::Type{Unsigned}, x::Int32 ) = convert(UInt32,x) +convert(::Type{Unsigned}, x::Int64 ) = convert(UInt64,x) +convert(::Type{Unsigned}, x::Int128 ) = convert(UInt128,x) +convert(::Type{Unsigned}, x::Float32) = convert(UInt,x) +convert(::Type{Unsigned}, x::Float64) = convert(UInt,x) +convert(::Type{Unsigned}, x::Char) = convert(UInt,x) +convert(::Type{Unsigned}, x::Bool) = convert(UInt,x) convert(::Type{Integer}, x::Float32) = convert(Int,x) convert(::Type{Integer}, x::Float64) = convert(Int,x) @@ -240,15 +240,15 @@ int32(x) = convert(Int32,x) int64(x) = convert(Int64,x) int128(x) = convert(Int128,x) -uint8(x) = convert(Uint8,x) -uint8(x::Integer) = x % Uint8 -uint8(x::Int8) = box(Uint8,unbox(Int8,x)) -uint8(x::Bool) = convert(Uint8,x) +uint8(x) = convert(UInt8,x) +uint8(x::Integer) = x % UInt8 +uint8(x::Int8) = box(UInt8,unbox(Int8,x)) +uint8(x::Bool) = convert(UInt8,x) -uint16(x) = convert(Uint16,x) -uint32(x) = convert(Uint32,x) -uint64(x) = convert(Uint64,x) -uint128(x) = convert(Uint128,x) +uint16(x) = convert(UInt16,x) +uint32(x) = convert(UInt32,x) +uint64(x) = convert(UInt64,x) +uint128(x) = convert(UInt128,x) integer(x) = convert(Integer,x) @@ -294,94 +294,94 @@ promote_rule(::Type{Int128}, ::Type{Int16}) = Int128 promote_rule(::Type{Int128}, ::Type{Int32}) = Int128 promote_rule(::Type{Int128}, ::Type{Int64}) = Int128 -promote_rule(::Type{Uint16}, ::Type{Uint8} ) = Uint16 -promote_rule(::Type{Uint32}, ::Type{Uint8} ) = Uint32 -promote_rule(::Type{Uint32}, ::Type{Uint16}) = Uint32 -promote_rule(::Type{Uint64}, ::Type{Uint8} ) = Uint64 -promote_rule(::Type{Uint64}, ::Type{Uint16}) = Uint64 -promote_rule(::Type{Uint64}, ::Type{Uint32}) = Uint64 -promote_rule(::Type{Uint128}, ::Type{Uint8} ) = Uint128 -promote_rule(::Type{Uint128}, ::Type{Uint16}) = Uint128 -promote_rule(::Type{Uint128}, ::Type{Uint32}) = Uint128 -promote_rule(::Type{Uint128}, ::Type{Uint64}) = Uint128 - -promote_rule(::Type{Uint8}, ::Type{Int8} ) = Int -promote_rule(::Type{Uint8}, ::Type{Int16} ) = Int -promote_rule(::Type{Uint8}, ::Type{Int32} ) = Int -promote_rule(::Type{Uint8}, ::Type{Int64} ) = Int64 -promote_rule(::Type{Uint8}, ::Type{Int128}) = Int128 - -promote_rule(::Type{Uint16}, ::Type{Int8} ) = Int -promote_rule(::Type{Uint16}, ::Type{Int16} ) = Int -promote_rule(::Type{Uint16}, ::Type{Int32} ) = Int -promote_rule(::Type{Uint16}, ::Type{Int64} ) = Int64 -promote_rule(::Type{Uint16}, ::Type{Int128}) = Int128 +promote_rule(::Type{UInt16}, ::Type{UInt8} ) = UInt16 +promote_rule(::Type{UInt32}, ::Type{UInt8} ) = UInt32 +promote_rule(::Type{UInt32}, ::Type{UInt16}) = UInt32 +promote_rule(::Type{UInt64}, ::Type{UInt8} ) = UInt64 +promote_rule(::Type{UInt64}, ::Type{UInt16}) = UInt64 +promote_rule(::Type{UInt64}, ::Type{UInt32}) = UInt64 +promote_rule(::Type{UInt128}, ::Type{UInt8} ) = UInt128 +promote_rule(::Type{UInt128}, ::Type{UInt16}) = UInt128 +promote_rule(::Type{UInt128}, ::Type{UInt32}) = UInt128 +promote_rule(::Type{UInt128}, ::Type{UInt64}) = UInt128 + +promote_rule(::Type{UInt8}, ::Type{Int8} ) = Int +promote_rule(::Type{UInt8}, ::Type{Int16} ) = Int +promote_rule(::Type{UInt8}, ::Type{Int32} ) = Int +promote_rule(::Type{UInt8}, ::Type{Int64} ) = Int64 +promote_rule(::Type{UInt8}, ::Type{Int128}) = Int128 + +promote_rule(::Type{UInt16}, ::Type{Int8} ) = Int +promote_rule(::Type{UInt16}, ::Type{Int16} ) = Int +promote_rule(::Type{UInt16}, ::Type{Int32} ) = Int +promote_rule(::Type{UInt16}, ::Type{Int64} ) = Int64 +promote_rule(::Type{UInt16}, ::Type{Int128}) = Int128 if WORD_SIZE == 64 - promote_rule(::Type{Uint32}, ::Type{Int8} ) = Int - promote_rule(::Type{Uint32}, ::Type{Int16}) = Int - promote_rule(::Type{Uint32}, ::Type{Int32}) = Int + promote_rule(::Type{UInt32}, ::Type{Int8} ) = Int + promote_rule(::Type{UInt32}, ::Type{Int16}) = Int + promote_rule(::Type{UInt32}, ::Type{Int32}) = Int else - promote_rule(::Type{Uint32}, ::Type{Int8} ) = Uint - promote_rule(::Type{Uint32}, ::Type{Int16}) = Uint - promote_rule(::Type{Uint32}, ::Type{Int32}) = Uint + promote_rule(::Type{UInt32}, ::Type{Int8} ) = UInt + promote_rule(::Type{UInt32}, ::Type{Int16}) = UInt + promote_rule(::Type{UInt32}, ::Type{Int32}) = UInt end -promote_rule(::Type{Uint32}, ::Type{Int64} ) = Int64 -promote_rule(::Type{Uint32}, ::Type{Int128}) = Int128 +promote_rule(::Type{UInt32}, ::Type{Int64} ) = Int64 +promote_rule(::Type{UInt32}, ::Type{Int128}) = Int128 -promote_rule(::Type{Uint64}, ::Type{Int8} ) = Uint64 -promote_rule(::Type{Uint64}, ::Type{Int16} ) = Uint64 -promote_rule(::Type{Uint64}, ::Type{Int32} ) = Uint64 -promote_rule(::Type{Uint64}, ::Type{Int64} ) = Uint64 -promote_rule(::Type{Uint64}, ::Type{Int128}) = Int128 +promote_rule(::Type{UInt64}, ::Type{Int8} ) = UInt64 +promote_rule(::Type{UInt64}, ::Type{Int16} ) = UInt64 +promote_rule(::Type{UInt64}, ::Type{Int32} ) = UInt64 +promote_rule(::Type{UInt64}, ::Type{Int64} ) = UInt64 +promote_rule(::Type{UInt64}, ::Type{Int128}) = Int128 -promote_rule(::Type{Uint128}, ::Type{Int8} ) = Uint128 -promote_rule(::Type{Uint128}, ::Type{Int16} ) = Uint128 -promote_rule(::Type{Uint128}, ::Type{Int32} ) = Uint128 -promote_rule(::Type{Uint128}, ::Type{Int64} ) = Uint128 -promote_rule(::Type{Uint128}, ::Type{Int128}) = Uint128 +promote_rule(::Type{UInt128}, ::Type{Int8} ) = UInt128 +promote_rule(::Type{UInt128}, ::Type{Int16} ) = UInt128 +promote_rule(::Type{UInt128}, ::Type{Int32} ) = UInt128 +promote_rule(::Type{UInt128}, ::Type{Int64} ) = UInt128 +promote_rule(::Type{UInt128}, ::Type{Int128}) = UInt128 ## traits ## typemin(::Type{Int8 }) = int8(-128) typemax(::Type{Int8 }) = int8(127) -typemin(::Type{Uint8 }) = uint8(0) -typemax(::Type{Uint8 }) = uint8(255) +typemin(::Type{UInt8 }) = uint8(0) +typemax(::Type{UInt8 }) = uint8(255) typemin(::Type{Int16 }) = int16(-32768) typemax(::Type{Int16 }) = int16(32767) -typemin(::Type{Uint16}) = uint16(0) -typemax(::Type{Uint16}) = uint16(65535) +typemin(::Type{UInt16}) = uint16(0) +typemax(::Type{UInt16}) = uint16(65535) typemin(::Type{Int32 }) = int32(-2147483648) typemax(::Type{Int32 }) = int32(2147483647) -typemin(::Type{Uint32}) = uint32(0) -typemax(::Type{Uint32}) = uint32(4294967295) +typemin(::Type{UInt32}) = uint32(0) +typemax(::Type{UInt32}) = uint32(4294967295) typemin(::Type{Int64 }) = -9223372036854775808 typemax(::Type{Int64 }) = 9223372036854775807 -typemin(::Type{Uint64}) = uint64(0) -typemax(::Type{Uint64}) = 0xffffffffffffffff -@eval typemin(::Type{Uint128}) = $(uint128(0)) -@eval typemax(::Type{Uint128}) = $(box(Uint128,unbox(Int128,convert(Int128,-1)))) +typemin(::Type{UInt64}) = uint64(0) +typemax(::Type{UInt64}) = 0xffffffffffffffff +@eval typemin(::Type{UInt128}) = $(uint128(0)) +@eval typemax(::Type{UInt128}) = $(box(UInt128,unbox(Int128,convert(Int128,-1)))) @eval typemin(::Type{Int128} ) = $(convert(Int128,1)<>int32(1)))) +@eval typemax(::Type{Int128} ) = $(box(Int128,unbox(UInt128,typemax(UInt128)>>int32(1)))) widen(::Type{Int8}) = Int widen(::Type{Int16}) = Int widen(::Type{Int32}) = Int64 widen(::Type{Int64}) = Int128 -widen(::Type{Uint8}) = Uint -widen(::Type{Uint16}) = Uint -widen(::Type{Uint32}) = Uint64 -widen(::Type{Uint64}) = Uint128 +widen(::Type{UInt8}) = UInt +widen(::Type{UInt16}) = UInt +widen(::Type{UInt32}) = UInt64 +widen(::Type{UInt64}) = UInt128 ## float to integer coercion ## # requires int arithmetic defined, for the loops to work -for (f,t) in ((:uint8,:Uint8), (:uint16,:Uint16), (:uint32,:Uint32), (:uint64,:Uint64), +for (f,t) in ((:uint8,:UInt8), (:uint16,:UInt16), (:uint32,:UInt32), (:uint64,:UInt64), (:int8,:Int8), (:int16,:Int16), (:int32,:Int32), (:int64,:Int64), - (:int128,:Int128), (:uint128,:Uint128), - (:signed,:Int), (:unsigned,:Uint), (:integer,:Int), - (:int,:Int), (:uint,:Uint)) + (:int128,:Int128), (:uint128,:UInt128), + (:signed,:Int), (:unsigned,:UInt), (:integer,:Int), + (:int,:Int), (:uint,:UInt)) @eval ($f)(x::FloatingPoint) = iround($t,x) end @@ -389,23 +389,23 @@ end if WORD_SIZE==32 function widemul(u::Int64, v::Int64) - local u0::Uint64, v0::Uint64, w0::Uint64 - local u1::Int64, v1::Int64, w1::Uint64, w2::Int64, t::Uint64 + local u0::UInt64, v0::UInt64, w0::UInt64 + local u1::Int64, v1::Int64, w1::UInt64, w2::Int64, t::UInt64 u0 = u&0xffffffff; u1 = u>>32 v0 = v&0xffffffff; v1 = v>>32 w0 = u0*v0 - t = reinterpret(Uint64,u1)*v0 + (w0>>>32) + t = reinterpret(UInt64,u1)*v0 + (w0>>>32) w2 = reinterpret(Int64,t) >> 32 - w1 = u0*reinterpret(Uint64,v1) + (t&0xffffffff) + w1 = u0*reinterpret(UInt64,v1) + (t&0xffffffff) hi = u1*v1 + w2 + (reinterpret(Int64,w1) >> 32) lo = w0&0xffffffff + (w1 << 32) int128(hi)<<64 + int128(lo) end - function widemul(u::Uint64, v::Uint64) - local u0::Uint64, v0::Uint64, w0::Uint64 - local u1::Uint64, v1::Uint64, w1::Uint64, w2::Uint64, t::Uint64 + function widemul(u::UInt64, v::UInt64) + local u0::UInt64, v0::UInt64, w0::UInt64 + local u1::UInt64, v1::UInt64, w1::UInt64, w2::UInt64, t::UInt64 u0 = u&0xffffffff; u1 = u>>>32 v0 = v&0xffffffff; v1 = v>>>32 @@ -419,19 +419,19 @@ if WORD_SIZE==32 end function *(u::Int128, v::Int128) - u0 = u % Uint64; u1 = int64(u>>64) - v0 = v % Uint64; v1 = int64(v>>64) + u0 = u % UInt64; u1 = int64(u>>64) + v0 = v % UInt64; v1 = int64(v>>64) lolo = widemul(u0, v0) lohi = widemul(reinterpret(Int64,u0), v1) hilo = widemul(u1, reinterpret(Int64,v0)) - t = reinterpret(Uint128,hilo) + (lolo>>>64) - w1 = reinterpret(Uint128,lohi) + (t&0xffffffffffffffff) + t = reinterpret(UInt128,hilo) + (lolo>>>64) + w1 = reinterpret(UInt128,lohi) + (t&0xffffffffffffffff) int128(lolo&0xffffffffffffffff) + reinterpret(Int128,w1)<<64 end - function *(u::Uint128, v::Uint128) - u0 = u % Uint64; u1 = uint64(u>>>64) - v0 = v % Uint64; v1 = uint64(v>>>64) + function *(u::UInt128, v::UInt128) + u0 = u % UInt64; u1 = uint64(u>>>64) + v0 = v % UInt64; v1 = uint64(v>>>64) lolo = widemul(u0, v0) lohi = widemul(u0, v1) hilo = widemul(u1, v0) @@ -441,28 +441,28 @@ if WORD_SIZE==32 end div(x::Int128, y::Int128) = int128(div(BigInt(x),BigInt(y))) - div(x::Uint128, y::Uint128) = uint128(div(BigInt(x),BigInt(y))) + div(x::UInt128, y::UInt128) = uint128(div(BigInt(x),BigInt(y))) rem(x::Int128, y::Int128) = int128(rem(BigInt(x),BigInt(y))) - rem(x::Uint128, y::Uint128) = uint128(rem(BigInt(x),BigInt(y))) + rem(x::UInt128, y::UInt128) = uint128(rem(BigInt(x),BigInt(y))) mod(x::Int128, y::Int128) = int128(mod(BigInt(x),BigInt(y))) << (x::Int128, y::Int32) = y == 0 ? x : box(Int128,shl_int(unbox(Int128,x),unbox(Int32,y))) - << (x::Uint128, y::Int32) = y == 0 ? x : box(Uint128,shl_int(unbox(Uint128,x),unbox(Int32,y))) + << (x::UInt128, y::Int32) = y == 0 ? x : box(UInt128,shl_int(unbox(UInt128,x),unbox(Int32,y))) >> (x::Int128, y::Int32) = y == 0 ? x : box(Int128,ashr_int(unbox(Int128,x),unbox(Int32,y))) - >> (x::Uint128, y::Int32) = y == 0 ? x : box(Uint128,lshr_int(unbox(Uint128,x),unbox(Int32,y))) + >> (x::UInt128, y::Int32) = y == 0 ? x : box(UInt128,lshr_int(unbox(UInt128,x),unbox(Int32,y))) >>>(x::Int128, y::Int32) = y == 0 ? x : box(Int128,lshr_int(unbox(Int128,x),unbox(Int32,y))) - >>>(x::Uint128, y::Int32) = y == 0 ? x : box(Uint128,lshr_int(unbox(Uint128,x),unbox(Int32,y))) + >>>(x::UInt128, y::Int32) = y == 0 ? x : box(UInt128,lshr_int(unbox(UInt128,x),unbox(Int32,y))) else *(x::Int128, y::Int128) = box(Int128,mul_int(unbox(Int128,x),unbox(Int128,y))) - *(x::Uint128, y::Uint128) = box(Uint128,mul_int(unbox(Uint128,x),unbox(Uint128,y))) + *(x::UInt128, y::UInt128) = box(UInt128,mul_int(unbox(UInt128,x),unbox(UInt128,y))) div(x::Int128, y::Int128) = box(Int128,sdiv_int(unbox(Int128,x),unbox(Int128,y))) - div(x::Uint128, y::Uint128) = box(Uint128,udiv_int(unbox(Uint128,x),unbox(Uint128,y))) + div(x::UInt128, y::UInt128) = box(UInt128,udiv_int(unbox(UInt128,x),unbox(UInt128,y))) rem(x::Int128, y::Int128) = box(Int128,srem_int(unbox(Int128,x),unbox(Int128,y))) - rem(x::Uint128, y::Uint128) = box(Uint128,urem_int(unbox(Uint128,x),unbox(Uint128,y))) + rem(x::UInt128, y::UInt128) = box(UInt128,urem_int(unbox(UInt128,x),unbox(UInt128,y))) mod(x::Int128, y::Int128) = box(Int128,smod_int(unbox(Int128,x),unbox(Int128,y))) end @@ -480,13 +480,13 @@ for T in (Int16,Int32) checked_mul(x::$T, y::$T) = box($T,checked_smul(unbox($T,x),unbox($T,y))) end end -for T in (Uint8,Uint16,Uint32,Uint64)#,Uint128) ## FIXME: #4905 +for T in (UInt8,UInt16,UInt32,UInt64)#,UInt128) ## FIXME: #4905 @eval begin checked_add(x::$T, y::$T) = box($T,checked_uadd(unbox($T,x),unbox($T,y))) checked_sub(x::$T, y::$T) = box($T,checked_usub(unbox($T,x),unbox($T,y))) end end -for T in (Uint16,Uint32) +for T in (UInt16,UInt32) @eval begin checked_mul(x::$T, y::$T) = box($T,checked_umul(unbox($T,x),unbox($T,y))) end @@ -494,7 +494,7 @@ end # checked mul is broken for 8-bit types (LLVM bug?) ## FIXME: #4905 -for T in (Int8,Uint8) +for T in (Int8,UInt8) @eval function checked_mul(x::$T, y::$T) xy = widemul(x,y) (typemin($T) <= xy <= typemax($T)) || throw(OverflowError()) @@ -503,7 +503,7 @@ for T in (Int8,Uint8) end if WORD_SIZE == 32 -for T in (Int64,Uint64) +for T in (Int64,UInt64) @eval function checked_mul(x::$T, y::$T) xy = int128(x)*int128(y) (typemin($T) <= xy <= typemax($T)) || throw(OverflowError()) @@ -512,7 +512,7 @@ for T in (Int64,Uint64) end else checked_mul(x::Int64, y::Int64) = box(Int64,checked_smul(unbox(Int64,x),unbox(Int64,y))) - checked_mul(x::Uint64, y::Uint64) = box(Uint64,checked_umul(unbox(Uint64,x),unbox(Uint64,y))) + checked_mul(x::UInt64, y::UInt64) = box(UInt64,checked_umul(unbox(UInt64,x),unbox(UInt64,y))) end # checked ops are broken for 128-bit types (LLVM bug) ## FIXME: #4905 @@ -521,6 +521,6 @@ checked_add(x::Int128, y::Int128) = x + y checked_sub(x::Int128, y::Int128) = x - y checked_mul(x::Int128, y::Int128) = x * y -checked_add(x::Uint128, y::Uint128) = x + y -checked_sub(x::Uint128, y::Uint128) = x - y -checked_mul(x::Uint128, y::Uint128) = x * y +checked_add(x::UInt128, y::UInt128) = x + y +checked_sub(x::UInt128, y::UInt128) = x - y +checked_mul(x::UInt128, y::UInt128) = x * y diff --git a/base/interactiveutil.jl b/base/interactiveutil.jl index 8d79d693af77f..4af05d3eccc3d 100644 --- a/base/interactiveutil.jl +++ b/base/interactiveutil.jl @@ -111,13 +111,13 @@ end systemerror(:EmptyClipboard, 0==ccall((:EmptyClipboard, "user32"), stdcall, Cint, ())) x_u16 = utf16(x) # copy data to locked, allocated space - p = ccall((:GlobalAlloc, "kernel32"), stdcall, Ptr{Uint16}, (Uint16, Int32), 2, sizeof(x_u16)+2) + p = ccall((:GlobalAlloc, "kernel32"), stdcall, Ptr{UInt16}, (UInt16, Int32), 2, sizeof(x_u16)+2) systemerror(:GlobalAlloc, p==C_NULL) - plock = ccall((:GlobalLock, "kernel32"), stdcall, Ptr{Uint16}, (Ptr{Uint16},), p) + plock = ccall((:GlobalLock, "kernel32"), stdcall, Ptr{UInt16}, (Ptr{UInt16},), p) systemerror(:GlobalLock, plock==C_NULL) - ccall(:memcpy, Ptr{Uint16}, (Ptr{Uint16},Ptr{Uint16},Int), plock, x_u16, sizeof(x_u16)+2) + ccall(:memcpy, Ptr{UInt16}, (Ptr{UInt16},Ptr{UInt16},Int), plock, x_u16, sizeof(x_u16)+2) systemerror(:GlobalUnlock, 0==ccall((:GlobalUnlock, "kernel32"), stdcall, Cint, (Ptr{Void},), plock)) - pdata = ccall((:SetClipboardData, "user32"), stdcall, Ptr{Uint16}, (Uint32, Ptr{Uint16}), 13, p) + pdata = ccall((:SetClipboardData, "user32"), stdcall, Ptr{UInt16}, (UInt32, Ptr{UInt16}), 13, p) systemerror(:SetClipboardData, pdata!=p) ccall((:CloseClipboard, "user32"), stdcall, Void, ()) end @@ -125,13 +125,13 @@ end function clipboard() systemerror(:OpenClipboard, 0==ccall((:OpenClipboard, "user32"), stdcall, Cint, (Ptr{Void},), C_NULL)) - pdata = ccall((:GetClipboardData, "user32"), stdcall, Ptr{Uint16}, (Uint32,), 13) + pdata = ccall((:GetClipboardData, "user32"), stdcall, Ptr{UInt16}, (UInt32,), 13) systemerror(:SetClipboardData, pdata==C_NULL) systemerror(:CloseClipboard, 0==ccall((:CloseClipboard, "user32"), stdcall, Cint, ())) - plock = ccall((:GlobalLock, "kernel32"), stdcall, Ptr{Uint16}, (Ptr{Uint16},), pdata) + plock = ccall((:GlobalLock, "kernel32"), stdcall, Ptr{UInt16}, (Ptr{UInt16},), pdata) systemerror(:GlobalLock, plock==C_NULL) s = utf8(utf16(plock)) - systemerror(:GlobalUnlock, 0==ccall((:GlobalUnlock, "kernel32"), stdcall, Cint, (Ptr{Uint16},), plock)) + systemerror(:GlobalUnlock, 0==ccall((:GlobalUnlock, "kernel32"), stdcall, Cint, (Ptr{UInt16},), plock)) return s end end @@ -337,7 +337,7 @@ end @windows_only function download(url::AbstractString, filename::AbstractString) res = ccall((:URLDownloadToFileW,:urlmon),stdcall,Cuint, - (Ptr{Void},Ptr{Uint16},Ptr{Uint16},Cint,Ptr{Void}),0,utf16(url),utf16(filename),0,0) + (Ptr{Void},Ptr{UInt16},Ptr{UInt16},Cint,Ptr{Void}),0,utf16(url),utf16(filename),0,0) if res != 0 error("automatic download failed (error: $res): $url") end diff --git a/base/intfuncs.jl b/base/intfuncs.jl index d3d8b074ac2ff..839ff370d4da4 100644 --- a/base/intfuncs.jl +++ b/base/intfuncs.jl @@ -11,7 +11,7 @@ end # binary GCD (aka Stein's) algorithm # about 1.7x (2.1x) faster for random Int64s (Int128s) -function gcd{T<:Union(Int64,Uint64,Int128,Uint128)}(a::T, b::T) +function gcd{T<:Union(Int64,UInt64,Int128,UInt128)}(a::T, b::T) a == 0 && return abs(b) b == 0 && return abs(a) za = trailing_zeros(a) @@ -161,12 +161,12 @@ const powers_of_ten = [ 0x000000e8d4a51000, 0x000009184e72a000, 0x00005af3107a4000, 0x00038d7ea4c68000, 0x002386f26fc10000, 0x016345785d8a0000, 0x0de0b6b3a7640000, 0x8ac7230489e80000, ] -function ndigits0z(x::Union(Uint8,Uint16,Uint32,Uint64)) +function ndigits0z(x::Union(UInt8,UInt16,UInt32,UInt64)) lz = (sizeof(x)<<3)-leading_zeros(x) nd = (1233*lz)>>12+1 nd -= x < powers_of_ten[nd] end -function ndigits0z(x::Uint128) +function ndigits0z(x::UInt128) n = 0 while x > 0x8ac7230489e80000 x = div(x,0x8ac7230489e80000) @@ -222,7 +222,7 @@ ndigits(x::Integer) = ndigits(unsigned(abs(x))) function bin(x::Unsigned, pad::Int, neg::Bool) i = neg + max(pad,sizeof(x)<<3-leading_zeros(x)) - a = Array(Uint8,i) + a = Array(UInt8,i) while i > neg a[i] = '0'+(x&0x1) x >>= 1 @@ -234,7 +234,7 @@ end function oct(x::Unsigned, pad::Int, neg::Bool) i = neg + max(pad,div((sizeof(x)<<3)-leading_zeros(x)+2,3)) - a = Array(Uint8,i) + a = Array(UInt8,i) while i > neg a[i] = '0'+(x&0x7) x >>= 3 @@ -246,7 +246,7 @@ end function dec(x::Unsigned, pad::Int, neg::Bool) i = neg + max(pad,ndigits0z(x)) - a = Array(Uint8,i) + a = Array(UInt8,i) while i > neg a[i] = '0'+rem(x,10) x = oftype(x,div(x,10)) @@ -258,7 +258,7 @@ end function hex(x::Unsigned, pad::Int, neg::Bool) i = neg + max(pad,(sizeof(x)<<1)-(leading_zeros(x)>>2)) - a = Array(Uint8,i) + a = Array(UInt8,i) while i > neg d = x & 0xf a[i] = '0'+d+39*(d>9) @@ -278,7 +278,7 @@ function base(b::Int, x::Unsigned, pad::Int, neg::Bool) if !(2 <= b <= 62) error("invalid base: $b") end digits = b <= 36 ? base36digits : base62digits i = neg + max(pad,ndigits0z(x,b)) - a = Array(Uint8,i) + a = Array(UInt8,i) while i > neg a[i] = digits[1+rem(x,b)] x = div(x,b) @@ -300,11 +300,11 @@ for sym in (:bin, :oct, :dec, :hex) end end -bits(x::Union(Bool,Int8,Uint8)) = bin(reinterpret(Uint8,x),8) -bits(x::Union(Int16,Uint16,Float16)) = bin(reinterpret(Uint16,x),16) -bits(x::Union(Char,Int32,Uint32,Float32)) = bin(reinterpret(Uint32,x),32) -bits(x::Union(Int64,Uint64,Float64)) = bin(reinterpret(Uint64,x),64) -bits(x::Union(Int128,Uint128)) = bin(reinterpret(Uint128,x),128) +bits(x::Union(Bool,Int8,UInt8)) = bin(reinterpret(UInt8,x),8) +bits(x::Union(Int16,UInt16,Float16)) = bin(reinterpret(UInt16,x),16) +bits(x::Union(Char,Int32,UInt32,Float32)) = bin(reinterpret(UInt32,x),32) +bits(x::Union(Int64,UInt64,Float64)) = bin(reinterpret(UInt64,x),64) +bits(x::Union(Int128,UInt128)) = bin(reinterpret(UInt128,x),128) function digits{T<:Integer}(n::Integer, base::T=10, pad::Int=1) 2 <= base || error("invalid base: $base") @@ -325,7 +325,7 @@ end isqrt(x::Integer) = oftype(x, trunc(sqrt(x))) -function isqrt(x::Union(Int64,Uint64,Int128,Uint128)) +function isqrt(x::Union(Int64,UInt64,Int128,UInt128)) x==0 && return x s = oftype(x, trunc(sqrt(x))) # fix with a Newton iteration, since conversion to float discards diff --git a/base/intset.jl b/base/intset.jl index 333c5a2ce879e..19f1eaf6660a8 100644 --- a/base/intset.jl +++ b/base/intset.jl @@ -1,9 +1,9 @@ type IntSet - bits::Array{Uint32,1} + bits::Array{UInt32,1} limit::Int fill1s::Bool - IntSet() = new(zeros(Uint32,256>>>5), 256, false) + IntSet() = new(zeros(UInt32,256>>>5), 256, false) end IntSet(itr) = (s=IntSet(); for a in itr; push!(s,a); end; s) @@ -139,13 +139,13 @@ function next(s::IntSet, i) if i >= s.limit n = int64(i) else - n = int64(ccall(:bitvector_next, Uint64, (Ptr{Uint32}, Uint64, Uint64), s.bits, i, s.limit)) + n = int64(ccall(:bitvector_next, UInt64, (Ptr{UInt32}, UInt64, UInt64), s.bits, i, s.limit)) end (n, n+1) end isempty(s::IntSet) = - !s.fill1s && ccall(:bitvector_any1, Uint32, (Ptr{Uint32}, Uint64, Uint64), s.bits, 0, s.limit)==0 + !s.fill1s && ccall(:bitvector_any1, UInt32, (Ptr{UInt32}, UInt64, UInt64), s.bits, 0, s.limit)==0 function first(s::IntSet) n = next(s,0)[1] @@ -169,7 +169,7 @@ function last(s::IntSet) error("set has no last element") end -length(s::IntSet) = int(ccall(:bitvector_count, Uint64, (Ptr{Uint32}, Uint64, Uint64), s.bits, 0, s.limit)) + +length(s::IntSet) = int(ccall(:bitvector_count, UInt64, (Ptr{UInt32}, UInt64, UInt64), s.bits, 0, s.limit)) + (s.fill1s ? typemax(Int) - s.limit : 0) function show(io::IO, s::IntSet) diff --git a/base/io.jl b/base/io.jl index c6d9e684e0922..b17e0123a0087 100644 --- a/base/io.jl +++ b/base/io.jl @@ -6,7 +6,7 @@ ## byte-order mark, ntoh & hton ## -const ENDIAN_BOM = reinterpret(Uint32,uint8([1:4]))[1] +const ENDIAN_BOM = reinterpret(UInt32,uint8([1:4]))[1] if ENDIAN_BOM == 0x01020304 ntoh(x) = x @@ -27,7 +27,7 @@ isreadonly(s) = isreadable(s) && !iswritable(s) ## binary I/O ## # all subtypes should implement this -write(s::IO, x::Uint8) = error(typeof(s)," does not support byte I/O") +write(s::IO, x::UInt8) = error(typeof(s)," does not support byte I/O") write(io::IO, x) = throw(MethodError(write, (io, x))) write(io::IO, xs...) = for x in xs write(io, x) end @@ -64,7 +64,7 @@ function write(s::IO, a::AbstractArray) end function write(s::IO, ch::Char) - c = reinterpret(Uint32, ch) + c = reinterpret(UInt32, ch) if c < 0x80 write(s, uint8(c)) return 1 @@ -96,22 +96,22 @@ function write(s::IO, p::Ptr, n::Integer) end function write(io::IO, s::Symbol) - pname = convert(Ptr{Uint8}, s) - write(io, pname, int(ccall(:strlen, Csize_t, (Ptr{Uint8},), pname))) + pname = convert(Ptr{UInt8}, s) + write(io, pname, int(ccall(:strlen, Csize_t, (Ptr{UInt8},), pname))) end # all subtypes should implement this -read(s::IO, x::Type{Uint8}) = error(typeof(s)," does not support byte I/O") +read(s::IO, x::Type{UInt8}) = error(typeof(s)," does not support byte I/O") function read{T <: Integer}(s::IO, ::Type{T}) x = zero(T) for n = 1:sizeof(x) - x |= (convert(T,read(s,Uint8))<<((n-1)<<3)) + x |= (convert(T,read(s,UInt8))<<((n-1)<<3)) end return x end -read(s::IO, ::Type{Bool}) = (read(s,Uint8)!=0) +read(s::IO, ::Type{Bool}) = (read(s,UInt8)!=0) read(s::IO, ::Type{Float16}) = box(Float16,unbox(Int16,read(s,Int16))) read(s::IO, ::Type{Float32}) = box(Float32,unbox(Int32,read(s,Int32))) read(s::IO, ::Type{Float64}) = box(Float64,unbox(Int64,read(s,Int64))) @@ -131,18 +131,18 @@ function read!{T}(s::IO, a::Array{T}) end function read(s::IO, ::Type{Char}) - ch = read(s, Uint8) + ch = read(s, UInt8) if ch < 0x80 return char(ch) end # mimic utf8.next function trailing = Base.utf8_trailing[ch+1] - c::Uint32 = 0 + c::UInt32 = 0 for j = 1:trailing c += ch c <<= 6 - ch = read(s, Uint8) + ch = read(s, UInt8) end c += ch c -= Base.utf8_offset[trailing+1] @@ -216,11 +216,11 @@ readline(s::IO) = readuntil(s, '\n') readchomp(x) = chomp!(readall(x)) # read up to nb bytes into nb, returning # bytes read -function readbytes!(s::IO, b::AbstractArray{Uint8}, nb=length(b)) +function readbytes!(s::IO, b::AbstractArray{UInt8}, nb=length(b)) olb = lb = length(b) nr = 0 while nr < nb && !eof(s) - a = read(s, Uint8) + a = read(s, UInt8) nr += 1 if nr > lb lb = nr * 2 @@ -234,9 +234,9 @@ function readbytes!(s::IO, b::AbstractArray{Uint8}, nb=length(b)) return nr end -# read up to nb bytes from s, returning a Vector{Uint8} of bytes read. +# read up to nb bytes from s, returning a Vector{UInt8} of bytes read. function readbytes(s::IO, nb=typemax(Int)) - b = Array(Uint8, nb == typemax(Int) ? 1024 : nb) + b = Array(UInt8, nb == typemax(Int) ? 1024 : nb) nr = readbytes!(s, b, nb) resize!(b, nr) end diff --git a/base/iobuffer.jl b/base/iobuffer.jl index 665d40dbf8a74..57b274dec41ad 100644 --- a/base/iobuffer.jl +++ b/base/iobuffer.jl @@ -1,8 +1,8 @@ -## work with Vector{Uint8} via I/O primitives ## +## work with Vector{UInt8} via I/O primitives ## # Stateful string type IOBuffer <: IO - data::Vector{Uint8} + data::Vector{UInt8} readable::Bool writable::Bool seekable::Bool # if not seekable, free to destroy (compact) past read data @@ -12,7 +12,7 @@ type IOBuffer <: IO ptr::Int # read (and maybe write) pointer mark::Int - IOBuffer(data::Vector{Uint8},readable::Bool,writable::Bool,seekable::Bool,append::Bool,maxsize::Int) = + IOBuffer(data::Vector{UInt8},readable::Bool,writable::Bool,seekable::Bool,append::Bool,maxsize::Int) = new(data,readable,writable,seekable,append,length(data),maxsize,1,-1) end @@ -24,7 +24,7 @@ function copy(b::IOBuffer) ret end -show(io::IO, b::IOBuffer) = print(io, "IOBuffer(data=Uint8[...], ", +show(io::IO, b::IOBuffer) = print(io, "IOBuffer(data=UInt8[...], ", "readable=", b.readable, ", ", "writable=", b.writable, ", ", "seekable=", b.seekable, ", ", @@ -35,20 +35,20 @@ show(io::IO, b::IOBuffer) = print(io, "IOBuffer(data=Uint8[...], ", "mark=", b.mark, ")") # PipeBuffers behave like Unix Pipes. They are readable and writable, the act appendable, and not seekable. -PipeBuffer(data::Vector{Uint8},maxsize::Int) = IOBuffer(data,true,true,false,true,maxsize) -PipeBuffer(data::Vector{Uint8}) = PipeBuffer(data,typemax(Int)) -PipeBuffer() = PipeBuffer(Uint8[]) -PipeBuffer(maxsize::Int) = (x = PipeBuffer(Array(Uint8,maxsize),maxsize); x.size=0; x) +PipeBuffer(data::Vector{UInt8},maxsize::Int) = IOBuffer(data,true,true,false,true,maxsize) +PipeBuffer(data::Vector{UInt8}) = PipeBuffer(data,typemax(Int)) +PipeBuffer() = PipeBuffer(UInt8[]) +PipeBuffer(maxsize::Int) = (x = PipeBuffer(Array(UInt8,maxsize),maxsize); x.size=0; x) # IOBuffers behave like Files. They are readable and writable. They are seekable. (They can be appendable). -IOBuffer(data::Vector{Uint8},readable::Bool,writable::Bool,maxsize::Int) = +IOBuffer(data::Vector{UInt8},readable::Bool,writable::Bool,maxsize::Int) = IOBuffer(data,readable,writable,true,false,maxsize) -IOBuffer(data::Vector{Uint8},readable::Bool,writable::Bool) = IOBuffer(data,readable,writable,typemax(Int)) -IOBuffer(data::Vector{Uint8}) = IOBuffer(data, true, false) +IOBuffer(data::Vector{UInt8},readable::Bool,writable::Bool) = IOBuffer(data,readable,writable,typemax(Int)) +IOBuffer(data::Vector{UInt8}) = IOBuffer(data, true, false) IOBuffer(str::ByteString) = IOBuffer(str.data, true, false) -IOBuffer(readable::Bool,writable::Bool) = IOBuffer(Uint8[],readable,writable) -IOBuffer() = IOBuffer(Uint8[], true, true) -IOBuffer(maxsize::Int) = (x=IOBuffer(Array(Uint8,maxsize),true,true,maxsize); x.size=0; x) +IOBuffer(readable::Bool,writable::Bool) = IOBuffer(UInt8[],readable,writable) +IOBuffer() = IOBuffer(UInt8[], true, true) +IOBuffer(maxsize::Int) = (x=IOBuffer(Array(UInt8,maxsize),true,true,maxsize); x.size=0; x) is_maxsize_unlimited(io::IOBuffer) = (io.maxsize == typemax(Int)) @@ -70,7 +70,7 @@ function read!(from::IOBuffer, p::Ptr, nb::Int) if !from.readable error("read failed") end avail = nb_available(from) adv = min(avail,nb) - ccall(:memcpy, Ptr{Void}, (Ptr{Void}, Ptr{Void}, Uint), p, pointer(from.data,from.ptr), adv) + ccall(:memcpy, Ptr{Void}, (Ptr{Void}, Ptr{Void}, UInt), p, pointer(from.data,from.ptr), adv) from.ptr += adv if nb > avail throw(EOFError()) @@ -78,7 +78,7 @@ function read!(from::IOBuffer, p::Ptr, nb::Int) p end -function read(from::IOBuffer, ::Type{Uint8}) +function read(from::IOBuffer, ::Type{UInt8}) if !from.readable error("read failed") end if from.ptr > from.size throw(EOFError()) @@ -96,7 +96,7 @@ function peek(from::IOBuffer) return from.data[from.ptr] end -read{T}(from::IOBuffer, ::Type{Ptr{T}}) = convert(Ptr{T}, read(from, Uint)) +read{T}(from::IOBuffer, ::Type{Ptr{T}}) = convert(Ptr{T}, read(from, UInt)) isreadable(io::IOBuffer) = io.readable iswritable(io::IOBuffer) = io.writable @@ -149,7 +149,7 @@ function compact(io::IOBuffer) ptr = io.ptr bytes_to_move = nb_available(io) end - ccall(:memmove, Ptr{Void}, (Ptr{Void},Ptr{Void},Uint), + ccall(:memmove, Ptr{Void}, (Ptr{Void},Ptr{Void},UInt), io.data, pointer(io.data,ptr), bytes_to_move) io.size -= ptr - 1 io.ptr -= ptr - 1 @@ -186,7 +186,7 @@ function close(io::IOBuffer) if io.writable resize!(io.data, 0) else - io.data = Uint8[] + io.data = UInt8[] end io.readable = false io.writable = false @@ -209,14 +209,14 @@ function takebuf_array(io::IOBuffer) data = io.data if io.writable maxsize = (io.maxsize == typemax(Int) ? 0 : io.maxsize) - io.data = Array(Uint8,maxsize) + io.data = Array(UInt8,maxsize) else data = copy(data) end resize!(data,io.size) else nbytes = nb_available(io) - a = Array(Uint8, nbytes) + a = Array(UInt8, nbytes) data = read!(io, a) end if io.writable @@ -238,7 +238,7 @@ function write(to::IOBuffer, p::Ptr, nb::Int) ensureroom(to, nb) ptr = (to.append ? to.size+1 : to.ptr) nb = min(nb, length(to.data) - ptr + 1) - ccall(:memcpy, Ptr{Void}, (Ptr{Void}, Ptr{Void}, Uint), pointer(to.data,ptr), p, nb) + ccall(:memcpy, Ptr{Void}, (Ptr{Void}, Ptr{Void}, UInt), pointer(to.data,ptr), p, nb) to.size = max(to.size, ptr - 1 + nb) if !to.append to.ptr += nb end nb @@ -261,7 +261,7 @@ end write(to::IOBuffer, a::Array) = write_sub(to, a, 1, length(a)) -function write(to::IOBuffer, a::Uint8) +function write(to::IOBuffer, a::UInt8) if !to.writable error("write failed") end ensureroom(to, 1) ptr = (to.append ? to.size+1 : to.ptr) @@ -272,12 +272,12 @@ function write(to::IOBuffer, a::Uint8) end to.size = max(to.size, ptr) if !to.append to.ptr += 1 end - sizeof(Uint8) + sizeof(UInt8) end -write(to::IOBuffer, p::Ptr) = write(to, convert(Uint, p)) +write(to::IOBuffer, p::Ptr) = write(to, convert(UInt, p)) -function readbytes!(io::IOBuffer, b::Array{Uint8}, nb=length(b)) +function readbytes!(io::IOBuffer, b::Array{UInt8}, nb=length(b)) nr = min(nb, nb_available(io)) if length(b) < nr resize!(b, nr) @@ -285,18 +285,18 @@ function readbytes!(io::IOBuffer, b::Array{Uint8}, nb=length(b)) read_sub(io, b, 1, nr) return nr end -readbytes(io::IOBuffer) = read!(io, Array(Uint8, nb_available(io))) -readbytes(io::IOBuffer, nb) = read!(io, Array(Uint8, min(nb, nb_available(io)))) +readbytes(io::IOBuffer) = read!(io, Array(UInt8, nb_available(io))) +readbytes(io::IOBuffer, nb) = read!(io, Array(UInt8, min(nb, nb_available(io)))) function search(buf::IOBuffer, delim) p = pointer(buf.data, buf.ptr) - q = ccall(:memchr,Ptr{Uint8},(Ptr{Uint8},Int32,Csize_t),p,delim,nb_available(buf)) + q = ccall(:memchr,Ptr{UInt8},(Ptr{UInt8},Int32,Csize_t),p,delim,nb_available(buf)) nb = (q == C_NULL ? 0 : q-p+1) end -function readuntil(io::IOBuffer, delim::Uint8) +function readuntil(io::IOBuffer, delim::UInt8) lb = 70 - A = Array(Uint8, lb) + A = Array(UInt8, lb) n = 0 data = io.data for i = io.ptr : io.size diff --git a/base/iostream.jl b/base/iostream.jl index 95d682b62992a..fe77084f35967 100644 --- a/base/iostream.jl +++ b/base/iostream.jl @@ -4,16 +4,16 @@ const sizeof_ios_t = int(ccall(:jl_sizeof_ios_t, Int32, ())) type IOStream <: IO handle::Ptr{Void} - ios::Array{Uint8,1} + ios::Array{UInt8,1} name::AbstractString mark::Int64 - IOStream(name::AbstractString, buf::Array{Uint8,1}) = new(pointer(buf), buf, name, -1) + IOStream(name::AbstractString, buf::Array{UInt8,1}) = new(pointer(buf), buf, name, -1) end # TODO: delay adding finalizer, e.g. for memio with a small buffer, or # in the case where we takebuf it. function IOStream(name::AbstractString, finalize::Bool) - buf = zeros(Uint8,sizeof_ios_t) + buf = zeros(UInt8,sizeof_ios_t) x = IOStream(name, buf) if finalize finalizer(x, close) @@ -40,7 +40,7 @@ modestr(s::IO) = modestr(isreadable(s), iswritable(s)) modestr(r::Bool, w::Bool) = r ? (w ? "r+" : "r") : (w ? "w" : error("Neither readable nor writable")) function truncate(s::IOStream, n::Integer) - systemerror("truncate", ccall(:ios_trunc, Int32, (Ptr{Void}, Uint), s.ios, n) != 0) + systemerror("truncate", ccall(:ios_trunc, Int32, (Ptr{Void}, UInt), s.ios, n) != 0) return s end @@ -81,8 +81,8 @@ immutable CFILE end function CFILE(s::IO) - @unix_only FILEp = ccall(:fdopen, Ptr{Void}, (Cint, Ptr{Uint8}), convert(Cint, fd(s)), modestr(s)) - @windows_only FILEp = ccall(:_fdopen, Ptr{Void}, (Cint, Ptr{Uint8}), convert(Cint, fd(s)), modestr(s)) + @unix_only FILEp = ccall(:fdopen, Ptr{Void}, (Cint, Ptr{UInt8}), convert(Cint, fd(s)), modestr(s)) + @windows_only FILEp = ccall(:_fdopen, Ptr{Void}, (Cint, Ptr{UInt8}), convert(Cint, fd(s)), modestr(s)) systemerror("fdopen", FILEp == C_NULL) seek(CFILE(FILEp), position(s)) end @@ -112,7 +112,7 @@ function open(fname::AbstractString, rd::Bool, wr::Bool, cr::Bool, tr::Bool, ff: s = IOStream(string("")) systemerror("opening file $fname", ccall(:ios_file, Ptr{Void}, - (Ptr{Uint8}, Ptr{Uint8}, Int32, Int32, Int32, Int32), + (Ptr{UInt8}, Ptr{UInt8}, Int32, Int32, Int32, Int32), s.ios, fname, rd, wr, cr, tr) == C_NULL) if ff systemerror("seeking to end of file $fname", ccall(:ios_seek_end, FileOffset, (Ptr{Void},), s.ios) != 0) @@ -142,14 +142,14 @@ end ## low-level calls ## -write(s::IOStream, b::Uint8) = int(ccall(:ios_putc, Int32, (Uint8, Ptr{Void}), b, s.ios)) +write(s::IOStream, b::UInt8) = int(ccall(:ios_putc, Int32, (UInt8, Ptr{Void}), b, s.ios)) function write{T}(s::IOStream, a::Array{T}) if isbits(T) if !iswritable(s) error("attempt to write to a read-only IOStream") end - int(ccall(:ios_write, Uint, (Ptr{Void}, Ptr{Void}, Uint), + int(ccall(:ios_write, UInt, (Ptr{Void}, Ptr{Void}, UInt), s.ios, a, length(a)*sizeof(T))) else invoke(write, (IO, Array), s, a) @@ -160,7 +160,7 @@ function write(s::IOStream, p::Ptr, nb::Integer) if !iswritable(s) error("attempt to write to a read-only IOStream") end - int(ccall(:ios_write, Uint, (Ptr{Void}, Ptr{Void}, Uint), s.ios, p, nb)) + int(ccall(:ios_write, UInt, (Ptr{Void}, Ptr{Void}, UInt), s.ios, p, nb)) end function write{T,N,A<:Array}(s::IOStream, a::SubArray{T,N,A}) @@ -180,7 +180,7 @@ end # num bytes available without blocking nb_available(s::IOStream) = ccall(:jl_nb_available, Int32, (Ptr{Void},), s.ios) -function read(s::IOStream, ::Type{Uint8}) +function read(s::IOStream, ::Type{UInt8}) b = ccall(:ios_getc, Int32, (Ptr{Void},), s.ios) if b == -1 throw(EOFError()) @@ -191,8 +191,8 @@ end function read!{T}(s::IOStream, a::Array{T}) if isbits(T) nb = length(a)*sizeof(T) - if ccall(:ios_readall, Uint, - (Ptr{Void}, Ptr{Void}, Uint), s.ios, a, nb) < nb + if ccall(:ios_readall, UInt, + (Ptr{Void}, Ptr{Void}, UInt), s.ios, a, nb) < nb throw(EOFError()) end else @@ -215,16 +215,16 @@ takebuf_string(s::IOStream) = ccall(:jl_takebuf_string, ByteString, (Ptr{Void},), s.ios) takebuf_array(s::IOStream) = - ccall(:jl_takebuf_array, Vector{Uint8}, (Ptr{Void},), s.ios) + ccall(:jl_takebuf_array, Vector{UInt8}, (Ptr{Void},), s.ios) function takebuf_raw(s::IOStream) sz = position(s) - buf = ccall(:jl_takebuf_raw, Ptr{Uint8}, (Ptr{Void},), s.ios) + buf = ccall(:jl_takebuf_raw, Ptr{UInt8}, (Ptr{Void},), s.ios) return buf, sz end function sprint(size::Integer, f::Function, args...) - s = IOBuffer(Array(Uint8,size), true, true) + s = IOBuffer(Array(UInt8,size), true, true) truncate(s,0) f(s, args...) takebuf_string(s) @@ -234,11 +234,11 @@ sprint(f::Function, args...) = sprint(0, f, args...) write(x) = write(STDOUT::IO, x) -function readuntil(s::IOStream, delim::Uint8) - ccall(:jl_readuntil, Array{Uint8,1}, (Ptr{Void}, Uint8), s.ios, delim) +function readuntil(s::IOStream, delim::UInt8) + ccall(:jl_readuntil, Array{UInt8,1}, (Ptr{Void}, UInt8), s.ios, delim) end -function readbytes!(s::IOStream, b::Array{Uint8}, nb=length(b)) +function readbytes!(s::IOStream, b::Array{UInt8}, nb=length(b)) olb = lb = length(b) nr = 0 while !eof(s) && nr < nb @@ -246,8 +246,8 @@ function readbytes!(s::IOStream, b::Array{Uint8}, nb=length(b)) lb = max(65536, (nr+1) * 2) resize!(b, lb) end - nr += int(ccall(:ios_readall, Uint, - (Ptr{Void}, Ptr{Void}, Uint), + nr += int(ccall(:ios_readall, UInt, + (Ptr{Void}, Ptr{Void}, UInt), s.ios, pointer(b, nr+1), min(lb-nr, nb-nr))) end if lb > olb diff --git a/base/libc.jl b/base/libc.jl index 52d01d76125d4..19eebd12a38d9 100644 --- a/base/libc.jl +++ b/base/libc.jl @@ -1,8 +1,8 @@ ## time-related functions ## # TODO: check for usleep errors? -@unix_only systemsleep(s::Real) = ccall(:usleep, Int32, (Uint32,), uint32(iround(s*1e6))) -@windows_only systemsleep(s::Real) = (ccall(:Sleep, stdcall, Void, (Uint32,), uint32(iround(s*1e3))); return int32(0)) +@unix_only systemsleep(s::Real) = ccall(:usleep, Int32, (UInt32,), uint32(iround(s*1e6))) +@windows_only systemsleep(s::Real) = (ccall(:Sleep, stdcall, Void, (UInt32,), uint32(iround(s*1e3))); return int32(0)) type TmStruct sec::Int32 @@ -36,19 +36,19 @@ end strftime(t) = strftime("%c", t) strftime(fmt::AbstractString, t::Real) = strftime(fmt, TmStruct(t)) function strftime(fmt::AbstractString, tm::TmStruct) - timestr = Array(Uint8, 128) - n = ccall(:strftime, Int, (Ptr{Uint8}, Int, Ptr{Uint8}, Ptr{Void}), + timestr = Array(UInt8, 128) + n = ccall(:strftime, Int, (Ptr{UInt8}, Int, Ptr{UInt8}, Ptr{Void}), timestr, length(timestr), fmt, &tm) if n == 0 return "" end - bytestring(convert(Ptr{Uint8},timestr)) + bytestring(convert(Ptr{UInt8},timestr)) end strptime(timestr::AbstractString) = strptime("%c", timestr) function strptime(fmt::AbstractString, timestr::AbstractString) tm = TmStruct() - r = ccall(:strptime, Ptr{Uint8}, (Ptr{Uint8}, Ptr{Uint8}, Ptr{Void}), + r = ccall(:strptime, Ptr{UInt8}, (Ptr{UInt8}, Ptr{UInt8}, Ptr{Void}), timestr, fmt, &tm) # the following would tell mktime() that this is a local time, and that # it should try to guess the timezone. not sure if/how this should be @@ -76,11 +76,11 @@ getpid() = ccall(:jl_getpid, Int32, ()) ## network functions ## function gethostname() - hn = Array(Uint8, 256) - @unix_only err=ccall(:gethostname, Int32, (Ptr{Uint8}, Uint), hn, length(hn)) - @windows_only err=ccall(:gethostname, stdcall, Int32, (Ptr{Uint8}, Uint32), hn, length(hn)) + hn = Array(UInt8, 256) + @unix_only err=ccall(:gethostname, Int32, (Ptr{UInt8}, UInt), hn, length(hn)) + @windows_only err=ccall(:gethostname, stdcall, Int32, (Ptr{UInt8}, UInt32), hn, length(hn)) systemerror("gethostname", err != 0) - bytestring(convert(Ptr{Uint8},hn)) + bytestring(convert(Ptr{UInt8},hn)) end ## Memory related ## diff --git a/base/linalg/arpack.jl b/base/linalg/arpack.jl index 1e60e4274a6a0..49c05a6835a35 100644 --- a/base/linalg/arpack.jl +++ b/base/linalg/arpack.jl @@ -206,7 +206,7 @@ for (T, saupd_name, seupd_name, naupd_name, neupd_name) in iparam, ipntr, workd::Array{$T}, workl::Array{$T}, lworkl, info) ccall(($(string(naupd_name)), :libarpack), Void, - (Ptr{BlasInt}, Ptr{Uint8}, Ptr{BlasInt}, Ptr{Uint8}, Ptr{BlasInt}, + (Ptr{BlasInt}, Ptr{UInt8}, Ptr{BlasInt}, Ptr{UInt8}, Ptr{BlasInt}, Ptr{$T}, Ptr{$T}, Ptr{BlasInt}, Ptr{$T}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$T}, Ptr{$T}, Ptr{BlasInt}, Ptr{BlasInt}, Clong, Clong), ido, bmat, &n, evtype, &nev, TOL, resid, &ncv, v, &ldv, @@ -218,9 +218,9 @@ for (T, saupd_name, seupd_name, naupd_name, neupd_name) in iparam, ipntr, workd::Array{$T}, workl::Array{$T}, lworkl, info) ccall(($(string(neupd_name)), :libarpack), Void, - (Ptr{BlasInt}, Ptr{Uint8}, Ptr{BlasInt}, Ptr{$T}, Ptr{$T}, Ptr{$T}, - Ptr{BlasInt}, Ptr{$T}, Ptr{$T}, Ptr{$T}, Ptr{Uint8}, Ptr{BlasInt}, - Ptr{Uint8}, Ptr{BlasInt}, Ptr{$T}, Ptr{$T}, Ptr{BlasInt}, Ptr{$T}, + (Ptr{BlasInt}, Ptr{UInt8}, Ptr{BlasInt}, Ptr{$T}, Ptr{$T}, Ptr{$T}, + Ptr{BlasInt}, Ptr{$T}, Ptr{$T}, Ptr{$T}, Ptr{UInt8}, Ptr{BlasInt}, + Ptr{UInt8}, Ptr{BlasInt}, Ptr{$T}, Ptr{$T}, Ptr{BlasInt}, Ptr{$T}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$T}, Ptr{$T}, Ptr{BlasInt}, Ptr{BlasInt}, Clong, Clong, Clong), &rvec, howmny, select, dr, di, z, &ldz, sigmar, sigmai, @@ -233,7 +233,7 @@ for (T, saupd_name, seupd_name, naupd_name, neupd_name) in iparam, ipntr, workd::Array{$T}, workl::Array{$T}, lworkl, info) ccall(($(string(saupd_name)), :libarpack), Void, - (Ptr{BlasInt}, Ptr{Uint8}, Ptr{BlasInt}, Ptr{Uint8}, Ptr{BlasInt}, + (Ptr{BlasInt}, Ptr{UInt8}, Ptr{BlasInt}, Ptr{UInt8}, Ptr{BlasInt}, Ptr{$T}, Ptr{$T}, Ptr{BlasInt}, Ptr{$T}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$T}, Ptr{$T}, Ptr{BlasInt}, Ptr{BlasInt}, Clong, Clong), ido, bmat, &n, which, &nev, TOL, resid, &ncv, v, &ldv, @@ -246,8 +246,8 @@ for (T, saupd_name, seupd_name, naupd_name, neupd_name) in iparam, ipntr, workd::Array{$T}, workl::Array{$T}, lworkl, info) ccall(($(string(seupd_name)), :libarpack), Void, - (Ptr{BlasInt}, Ptr{Uint8}, Ptr{BlasInt}, Ptr{$T}, Ptr{$T}, Ptr{BlasInt}, Ptr{$T}, - Ptr{Uint8}, Ptr{BlasInt}, Ptr{Uint8}, Ptr{BlasInt}, + (Ptr{BlasInt}, Ptr{UInt8}, Ptr{BlasInt}, Ptr{$T}, Ptr{$T}, Ptr{BlasInt}, Ptr{$T}, + Ptr{UInt8}, Ptr{BlasInt}, Ptr{UInt8}, Ptr{BlasInt}, Ptr{$T}, Ptr{$T}, Ptr{BlasInt}, Ptr{$T}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$T}, Ptr{$T}, Ptr{BlasInt}, Ptr{BlasInt}, Clong, Clong, Clong), &rvec, howmny, select, d, z, &ldz, sigma, @@ -268,7 +268,7 @@ for (T, TR, naupd_name, neupd_name) in rwork::Array{$TR}, info) ccall(($(string(naupd_name)), :libarpack), Void, - (Ptr{BlasInt}, Ptr{Uint8}, Ptr{BlasInt}, Ptr{Uint8}, Ptr{BlasInt}, + (Ptr{BlasInt}, Ptr{UInt8}, Ptr{BlasInt}, Ptr{UInt8}, Ptr{BlasInt}, Ptr{$TR}, Ptr{$T}, Ptr{BlasInt}, Ptr{$T}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$T}, Ptr{$T}, Ptr{BlasInt}, Ptr{$TR}, Ptr{BlasInt}), @@ -283,8 +283,8 @@ for (T, TR, naupd_name, neupd_name) in rwork::Array{$TR}, info) ccall(($(string(neupd_name)), :libarpack), Void, - (Ptr{BlasInt}, Ptr{Uint8}, Ptr{BlasInt}, Ptr{$T}, Ptr{$T}, Ptr{BlasInt}, - Ptr{$T}, Ptr{$T}, Ptr{Uint8}, Ptr{BlasInt}, Ptr{Uint8}, Ptr{BlasInt}, + (Ptr{BlasInt}, Ptr{UInt8}, Ptr{BlasInt}, Ptr{$T}, Ptr{$T}, Ptr{BlasInt}, + Ptr{$T}, Ptr{$T}, Ptr{UInt8}, Ptr{BlasInt}, Ptr{UInt8}, Ptr{BlasInt}, Ptr{$TR}, Ptr{$T}, Ptr{BlasInt}, Ptr{$T}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$T}, Ptr{$T}, Ptr{BlasInt}, Ptr{$TR}, Ptr{BlasInt}), &rvec, howmny, select, d, z, &ldz, sigma, workev, diff --git a/base/linalg/bitarray.jl b/base/linalg/bitarray.jl index 5e9b70ee89fd9..1a8d24ff6a86e 100644 --- a/base/linalg/bitarray.jl +++ b/base/linalg/bitarray.jl @@ -21,8 +21,8 @@ end #if mA == 0; return C; end #col_ch = num_bit_chunks(mA) ## TODO: avoid using aux chunks and copy (?) - #aux_chunksA = zeros(Uint64, col_ch) - #aux_chunksB = [zeros(Uint64, col_ch) for j=1:nB] + #aux_chunksA = zeros(UInt64, col_ch) + #aux_chunksB = [zeros(UInt64, col_ch) for j=1:nB] #for j = 1:nB #Base.copy_chunks!(aux_chunksB[j], 1, B.chunks, (j-1)*mA+1, mA) #end @@ -135,7 +135,7 @@ end issym(A::BitMatrix) = size(A, 1)==size(A, 2) && countnz(A - A.')==0 ishermitian(A::BitMatrix) = issym(A) -function nonzero_chunks(chunks::Vector{Uint64}, pos0::Int, pos1::Int) +function nonzero_chunks(chunks::Vector{UInt64}, pos0::Int, pos1::Int) k0, l0 = Base.get_chunks_id(pos0) k1, l1 = Base.get_chunks_id(pos1) diff --git a/base/linalg/blas.jl b/base/linalg/blas.jl index 5e754e6c3f50e..7c9329b014f58 100644 --- a/base/linalg/blas.jl +++ b/base/linalg/blas.jl @@ -276,7 +276,7 @@ for (fname, elty) in ((:dgemv_,:Float64), m,n = size(A,1),size(A,2) length(X) == (trans == 'N' ? n : m) && length(Y) == (trans == 'N' ? m : n) || throw(DimensionMismatch("")) ccall(($(blasfunc(fname)), libblas), Void, - (Ptr{Uint8}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, + (Ptr{UInt8}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}), &trans, &size(A,1), &size(A,2), &alpha, @@ -308,7 +308,7 @@ for (fname, elty) in ((:dgbmv_,:Float64), # DOUBLE PRECISION A(LDA,*),X(*),Y(*) function gbmv!(trans::BlasChar, m::Integer, kl::Integer, ku::Integer, alpha::($elty), A::StridedMatrix{$elty}, x::StridedVector{$elty}, beta::($elty), y::StridedVector{$elty}) ccall(($(blasfunc(fname)), libblas), Void, - (Ptr{Uint8}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, + (Ptr{UInt8}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}), @@ -347,7 +347,7 @@ for (fname, elty) in ((:dsymv_,:Float64), if m != n throw(DimensionMismatch("Matrix A is $m by $n but must be square")) end if m != length(x) || m != length(y) throw(DimensionMismatch("")) end ccall(($(blasfunc(fname)), libblas), Void, - (Ptr{Uint8}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, + (Ptr{UInt8}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}), &uplo, &n, &alpha, A, @@ -376,7 +376,7 @@ for (fname, elty) in ((:zhemv_,:Complex128), incx = stride(x, 1) incy = stride(y, 1) ccall(($(blasfunc(fname)), libblas), Void, - (Ptr{Uint8}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, + (Ptr{UInt8}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}), &uplo, &n, &α, A, @@ -408,7 +408,7 @@ for (fname, elty) in ((:dsbmv_,:Float64), # DOUBLE PRECISION A(LDA,*),X(*),Y(*) function sbmv!(uplo::BlasChar, k::Integer, alpha::($elty), A::StridedMatrix{$elty}, x::StridedVector{$elty}, beta::($elty), y::StridedVector{$elty}) ccall(($(blasfunc(fname)), libblas), Void, - (Ptr{Uint8}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, + (Ptr{UInt8}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}), &uplo, &size(A,2), &k, &alpha, @@ -444,7 +444,7 @@ for (fname, elty) in ((:dtrmv_,:Float64), throw(DimensionMismatch("length(x)=$(length(x))does not match size(A)=$(size(A))")) end ccall(($(blasfunc(fname)), libblas), Void, - (Ptr{Uint8}, Ptr{Uint8}, Ptr{Uint8}, Ptr{BlasInt}, + (Ptr{UInt8}, Ptr{UInt8}, Ptr{UInt8}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}), &uplo, &trans, &diag, &n, A, &max(1,stride(A,2)), x, &max(1,stride(x, 1))) @@ -471,7 +471,7 @@ for (fname, elty) in ((:dtrsv_,:Float64), n = chksquare(A) n==length(x) || throw(DimensionMismatch("size of A is $n != length(x) = $(length(x))")) ccall(($(blasfunc(fname)), libblas), Void, - (Ptr{Uint8}, Ptr{Uint8}, Ptr{Uint8}, Ptr{BlasInt}, + (Ptr{UInt8}, Ptr{UInt8}, Ptr{UInt8}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}), &uplo, &trans, &diag, &n, A, &max(1,stride(A,2)), x, &1) @@ -515,7 +515,7 @@ for (fname, elty) in ((:dsyr_,:Float64), n = chksquare(A) length(x) == n || throw(DimensionMismatch("Length of vector must be the same as the matrix dimensions")) ccall(($(blasfunc(fname)), libblas), Void, - (Ptr{Uint8}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, + (Ptr{UInt8}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}), &uplo, &n, &α, x, &1, A, &max(1,stride(A,2))) @@ -532,7 +532,7 @@ for (fname, elty) in ((:zher_,:Complex128), n = chksquare(A) length(x) == A || throw(DimensionMismatch("Length of vector must be the same as the matrix dimensions")) ccall(($(blasfunc(fname)), libblas), Void, - (Ptr{Uint8}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, + (Ptr{UInt8}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}), &uplo, &n, &α, x, &1, A, &max(1,stride(A,2))) @@ -567,7 +567,7 @@ for (gemm, elty) in throw(DimensionMismatch("")) end ccall(($(blasfunc(gemm)), libblas), Void, - (Ptr{Uint8}, Ptr{Uint8}, Ptr{BlasInt}, Ptr{BlasInt}, + (Ptr{UInt8}, Ptr{UInt8}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}), @@ -604,7 +604,7 @@ for (mfname, elty) in ((:dsymm_,:Float64), j = chksquare(A) if j != (side == 'L' ? m : n) || size(B,2) != n throw(DimensionMismatch("")) end ccall(($(blasfunc(mfname)), libblas), Void, - (Ptr{Uint8}, Ptr{Uint8}, Ptr{BlasInt}, Ptr{BlasInt}, + (Ptr{UInt8}, Ptr{UInt8}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}), &side, &uplo, &m, &n, @@ -642,7 +642,7 @@ for (fname, elty) in ((:dsyrk_,:Float64), if nn != n throw(DimensionMismatch("syrk!")) end k = size(A, trans == 'N' ? 2 : 1) ccall(($(blasfunc(fname)), libblas), Void, - (Ptr{Uint8}, Ptr{Uint8}, Ptr{BlasInt}, Ptr{BlasInt}, + (Ptr{UInt8}, Ptr{UInt8}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}), &uplo, &trans, &n, &k, @@ -675,7 +675,7 @@ for (fname, elty) in ((:zherk_,:Complex128), (:cherk_,:Complex64)) n == size(A, trans == 'N' ? 1 : 2) || throw(DimensionMismatch("herk!")) k = size(A, trans == 'N' ? 2 : 1) ccall(($(blasfunc(fname)), libblas), Void, - (Ptr{Uint8}, Ptr{Uint8}, Ptr{BlasInt}, Ptr{BlasInt}, + (Ptr{UInt8}, Ptr{UInt8}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}), &uplo, &trans, &n, &k, @@ -714,7 +714,7 @@ for (fname, elty) in ((:dsyr2k_,:Float64), if nn != n throw(DimensionMismatch("syr2k!")) end k = size(A, trans == 'N' ? 2 : 1) ccall(($(blasfunc(fname)), libblas), Void, - (Ptr{Uint8}, Ptr{Uint8}, Ptr{BlasInt}, Ptr{BlasInt}, + (Ptr{UInt8}, Ptr{UInt8}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}), &uplo, &trans, &n, &k, @@ -750,7 +750,7 @@ for (fname, elty1, elty2) in ((:zher2k_,:Complex128,:Float64), (:cher2k_,:Comple n == size(A, trans == 'N' ? 1 : 2) || throw(DimensionMismatch("her2k!")) k = size(A, trans == 'N' ? 2 : 1) ccall(($(blasfunc(fname)), libblas), Void, - (Ptr{Uint8}, Ptr{Uint8}, Ptr{BlasInt}, Ptr{BlasInt}, + (Ptr{UInt8}, Ptr{UInt8}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty1}, Ptr{$elty1}, Ptr{BlasInt}, Ptr{$elty1}, Ptr{BlasInt}, Ptr{$elty2}, Ptr{$elty1}, Ptr{BlasInt}), &uplo, &trans, &n, &k, @@ -786,7 +786,7 @@ for (mmname, smname, elty) in nA = chksquare(A) if nA != (side == 'L' ? m : n) throw(DimensionMismatch("trmm!")) end ccall(($(blasfunc(mmname)), libblas), Void, - (Ptr{Uint8}, Ptr{Uint8}, Ptr{Uint8}, Ptr{Uint8}, Ptr{BlasInt}, Ptr{BlasInt}, + (Ptr{UInt8}, Ptr{UInt8}, Ptr{UInt8}, Ptr{UInt8}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}), &side, &uplo, &transa, &diag, &m, &n, &alpha, A, &max(1,stride(A,2)), B, &max(1,stride(B,2))) @@ -809,7 +809,7 @@ for (mmname, smname, elty) in k = chksquare(A) k==(side == 'L' ? m : n) || throw(DimensionMismatch("size of A is $n, size(B)=($m,$n) and transa='$transa'")) ccall(($(blasfunc(smname)), libblas), Void, - (Ptr{Uint8}, Ptr{Uint8}, Ptr{Uint8}, Ptr{Uint8}, + (Ptr{UInt8}, Ptr{UInt8}, Ptr{UInt8}, Ptr{UInt8}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}), &side, &uplo, &transa, &diag, diff --git a/base/linalg/cholmod.jl b/base/linalg/cholmod.jl index 3a469fee85fc9..3deb151f03ede 100644 --- a/base/linalg/cholmod.jl +++ b/base/linalg/cholmod.jl @@ -39,13 +39,13 @@ const chm_l_com = fill(0xff, chm_com_sz) ## to functions in libc.so, whose addresses can change function cmn(::Type{Int32}) if isnan(reinterpret(Float64,chm_com[1:8])[1]) - @isok ccall((:cholmod_start, :libcholmod), Cint, (Ptr{Uint8},), chm_com) + @isok ccall((:cholmod_start, :libcholmod), Cint, (Ptr{UInt8},), chm_com) end chm_com end function cmn(::Type{Int64}) if isnan(reinterpret(Float64,chm_l_com[1:8])[1]) - @isok ccall((:cholmod_l_start, :libcholmod), Cint, (Ptr{Uint8},), chm_l_com) + @isok ccall((:cholmod_l_start, :libcholmod), Cint, (Ptr{UInt8},), chm_l_com) end chm_l_com end @@ -92,15 +92,15 @@ const chm_prt_inds = (1:4) + chm_com_offsets[13] const chm_ityp_inds = (1:4) + chm_com_offsets[18] ### there must be an easier way but at least this works. -function ChmCommon(aa::Array{Uint8,1}) +function ChmCommon(aa::Array{UInt8,1}) typs = ChmCommon.types sz = map(sizeof, typs) args = map(i->reinterpret(typs[i], aa[chm_com_offsets[i] + (1:sz[i])])[1], 1:length(sz)) eval(Expr(:call, unshift!(args, :ChmCommon), Any)) end -function set_chm_prt_lev(cm::Array{Uint8}, lev::Integer) # can probably be removed - cm[(1:4) + chm_com_offsets[13]] = reinterpret(Uint8, [int32(lev)]) +function set_chm_prt_lev(cm::Array{UInt8}, lev::Integer) # can probably be removed + cm[(1:4) + chm_com_offsets[13]] = reinterpret(UInt8, [int32(lev)]) end ## cholmod_dense pointers passed to or returned from C functions are of Julia type @@ -343,12 +343,12 @@ CholmodDense!{T<:CHMVTypes}(c::Ptr{c_CholmodDense{T}}) = CholmodDense(c) # no di function isvalid{T<:CHMVTypes}(cd::CholmodDense{T}) bool(ccall((:cholmod_check_dense, :libcholmod), Cint, - (Ptr{c_CholmodDense{T}}, Ptr{Uint8}), &cd.c, cmn(Int32))) + (Ptr{c_CholmodDense{T}}, Ptr{UInt8}), &cd.c, cmn(Int32))) end function chm_eye{T<:Union(Float64,Complex128)}(m::Integer, n::Integer, t::T) CholmodDense(ccall((:cholmod_eye, :libcholmod), Ptr{c_CholmodDense{T}}, - (Int, Int, Cint, Ptr{Uint8}), + (Int, Int, Cint, Ptr{UInt8}), m, n,xtyp(T),cmn(Int32))) end chm_eye(m::Integer, n::Integer) = chm_eye(m, n, 1.) @@ -356,14 +356,14 @@ chm_eye(n::Integer) = chm_eye(n, n, 1.) function chm_ones{T<:Union(Float64,Complex128)}(m::Integer, n::Integer, t::T) CholmodDense(ccall((:cholmod_ones, :libcholmod), Ptr{c_CholmodDense{T}}, - (Int, Int, Cint, Ptr{Uint8}), + (Int, Int, Cint, Ptr{UInt8}), m, n, xtyp(T), cmn(Int32))) end chm_ones(m::Integer, n::Integer) = chm_ones(m, n, 1.) function chm_zeros{T<:Union(Float64,Complex128)}(m::Integer, n::Integer, t::T) CholmodDense(ccall((:cholmod_zeros, :libcholmod), Ptr{c_CholmodDense{T}}, - (Int, Int, Cint, Ptr{Uint8}), + (Int, Int, Cint, Ptr{UInt8}), m, n, xtyp(T), cmn(Int32))) end chm_zeros(m::Integer, n::Integer) = chm_zeros(m, n, 1.) @@ -371,9 +371,9 @@ chm_zeros(m::Integer, n::Integer) = chm_zeros(m, n, 1.) function chm_print{T<:CHMVTypes}(cd::CholmodDense{T}, lev::Integer, nm::ASCIIString) cm = cmn(Int32) orig = cm[chm_prt_inds] - cm[chm_prt_inds] = reinterpret(Uint8, [int32(lev)]) + cm[chm_prt_inds] = reinterpret(UInt8, [int32(lev)]) @isok ccall((:cholmod_print_dense, :libcholmod), Cint, - (Ptr{c_CholmodDense{T}}, Ptr{Uint8}, Ptr{Uint8}), + (Ptr{c_CholmodDense{T}}, Ptr{UInt8}, Ptr{UInt8}), &cd.c, nm, cm) cm[chm_prt_inds] = orig end @@ -383,12 +383,12 @@ show(io::IO,cd::CholmodDense) = chm_print(cd, int32(4), "") function copy{Tv<:CHMVTypes}(B::CholmodDense{Tv}) CholmodDense(ccall((:cholmod_copy_dense,:libcholmod), Ptr{c_CholmodDense{Tv}}, - (Ptr{c_CholmodDense{Tv}},Ptr{Uint8}), &B.c, cmn(Int32))) + (Ptr{c_CholmodDense{Tv}},Ptr{UInt8}), &B.c, cmn(Int32))) end function norm{Tv<:CHMVTypes}(D::CholmodDense{Tv},p::Real=1) ccall((:cholmod_norm_dense, :libcholmod), Float64, - (Ptr{c_CholmodDense{Tv}}, Cint, Ptr{Uint8}), + (Ptr{c_CholmodDense{Tv}}, Cint, Ptr{UInt8}), &D.c, p == 1 ? 1 :(p == Inf ? 1 : throw(ArgumentError("p must be 1 or Inf"))),cmn(Int32)) end @@ -464,9 +464,9 @@ function CholmodTriplet{Tv<:CHMVTypes,Ti<:CHMITypes}(tp::Ptr{c_CholmodTriplet{Tv end function chm_rdsp(fnm::AbstractString) - fd = ccall(:fopen, Ptr{Void}, (Ptr{Uint8},Ptr{Uint8}), fnm, "r") + fd = ccall(:fopen, Ptr{Void}, (Ptr{UInt8},Ptr{UInt8}), fnm, "r") res = ccall((:cholmod_read_sparse,:libcholmod), Ptr{c_CholmodSparse{Float64,Cint}}, - (Ptr{Void},Ptr{Uint8}),fd,cmn(Cint)) + (Ptr{Void},Ptr{UInt8}),fd,cmn(Cint)) ccall(:fclose, Cint, (Ptr{Void},), fd) # should do this in try/finally/end CholmodSparse(res) end @@ -478,7 +478,7 @@ for Ti in (:Int32,:Int64) CholmodSparse(ccall((@chm_nm "ssmult" $Ti , :libcholmod), Ptr{c_CholmodSparse{Tv,$Ti}}, (Ptr{c_CholmodSparse{Tv,$Ti}},Ptr{c_CholmodSparse{Tv,$Ti}}, - Cint,Cint,Cint,Ptr{Uint8}), &A.c,&B.c,0,true,true,cmn($Ti))) + Cint,Cint,Cint,Ptr{UInt8}), &A.c,&B.c,0,true,true,cmn($Ti))) end function A_mul_Bc{Tv<:Union(Float32,Float64)}(A::CholmodSparse{Tv,$Ti}, B::CholmodSparse{Tv,$Ti}) @@ -487,16 +487,16 @@ for Ti in (:Int32,:Int64) if !is(A,B) aa[1] = ccall((@chm_nm "transpose" $Ti ,:libcholmod), Ptr{c_CholmodSparse{Tv,$Ti}}, - (Ptr{c_CholmodSparse{Tv,$Ti}}, Ptr{Uint8}), + (Ptr{c_CholmodSparse{Tv,$Ti}}, Ptr{UInt8}), &B.c,cm) aa[2] = ccall((@chm_nm "ssmult" $Ti ,:libcholmod), Ptr{c_CholmodSparse{Tv,$Ti}}, (Ptr{c_CholmodSparse{Tv,$Ti}}, - Ptr{c_CholmodSparse{Tv,$Ti}}, Ptr{Uint8}), + Ptr{c_CholmodSparse{Tv,$Ti}}, Ptr{UInt8}), &A.c, aa[1], cmn($Ti)) @isok ccall((@chm_nm "free_sparse" $Ti ,:libcholmod), Cint, - (Ptr{Ptr{c_CholmodSparse{Tv,$Ti}}}, Ptr{Uint8}), aa, cm) + (Ptr{Ptr{c_CholmodSparse{Tv,$Ti}}}, Ptr{UInt8}), aa, cm) CholmodSparse(aa[2]) end ## The A*A' case is handled by cholmod_aat. Strangely the matrix returned by @@ -506,16 +506,16 @@ for Ti in (:Int32,:Int64) ## triangle aa[1] = ccall((@chm_nm "aat" $Ti , :libcholmod), Ptr{c_CholmodSparse{Tv,$Ti}}, - (Ptr{c_CholmodSparse{Tv,$Ti}}, Ptr{Void}, Int, Cint, Ptr{Uint8}), + (Ptr{c_CholmodSparse{Tv,$Ti}}, Ptr{Void}, Int, Cint, Ptr{UInt8}), &A.c, C_NULL, 0, 1, cm) ## Create the lower triangle unsorted aa[2] = ccall((@chm_nm "copy" $Ti , :libcholmod), Ptr{c_CholmodSparse{Tv,$Ti}}, - (Ptr{c_CholmodSparse{Tv,$Ti}}, Cint, Cint, Ptr{Uint8}), + (Ptr{c_CholmodSparse{Tv,$Ti}}, Cint, Cint, Ptr{UInt8}), aa[1], -1, 1, cm) @isok ccall((@chm_nm "free_sparse" $Ti , :libcholmod), Cint, - (Ptr{Ptr{c_CholmodSparse{Tv,$Ti}}}, Ptr{Uint8}), aa, cm) + (Ptr{Ptr{c_CholmodSparse{Tv,$Ti}}}, Ptr{UInt8}), aa, cm) aa[1] = aa[2] r = unsafe_load(aa[1]) ## Now transpose the lower triangle to the upper triangle to do the sorting @@ -526,11 +526,11 @@ for Ti in (:Int32,:Int64) @isok ccall((@chm_nm "transpose_sym" $Ti ,:libcholmod),Cint, (Ptr{c_CholmodSparse{Tv,$Ti}}, Cint, Ptr{$Ti}, - Ptr{c_CholmodSparse{Tv,$Ti}}, Ptr{Uint8}), + Ptr{c_CholmodSparse{Tv,$Ti}}, Ptr{UInt8}), aa[1],1,C_NULL,rpt,cm) @isok ccall((@chm_nm "free_sparse" $Ti , :libcholmod), Cint, - (Ptr{Ptr{c_CholmodSparse{Tv,$Ti}}}, Ptr{Uint8}), aa, cm) + (Ptr{Ptr{c_CholmodSparse{Tv,$Ti}}}, Ptr{UInt8}), aa, cm) CholmodSparse(rpt) end function Ac_mul_B{Tv<:Union(Float32,Float64)}(A::CholmodSparse{Tv,$Ti}, @@ -539,7 +539,7 @@ for Ti in (:Int32,:Int64) aa = Array(Ptr{c_CholmodSparse{Tv,$Ti}}, 2) aa[1] = ccall((@chm_nm "transpose" $Ti ,:libcholmod), Ptr{c_CholmodSparse{Tv,$Ti}}, - (Ptr{c_CholmodSparse{Tv,$Ti}}, Ptr{Uint8}), + (Ptr{c_CholmodSparse{Tv,$Ti}}, Ptr{UInt8}), &B.c,cm) if is(A,B) Ac = CholmodSparse(aa[1]) @@ -548,119 +548,119 @@ for Ti in (:Int32,:Int64) aa[2] = ccall((@chm_nm "ssmult" $Ti ,:libcholmod), Ptr{c_CholmodSparse{Tv,$Ti}}, (Ptr{c_CholmodSparse{Tv,$Ti}}, - Ptr{c_CholmodSparse{Tv,$Ti}}, Ptr{Uint8}), + Ptr{c_CholmodSparse{Tv,$Ti}}, Ptr{UInt8}), aa[1],&B.c,cm) @isok ccall((@chm_nm "free_sparse" $Ti , :libcholmod), Cint, - (Ptr{Ptr{c_CholmodSparse{Tv,$Ti}}}, Ptr{Uint8}), aa, cm) + (Ptr{Ptr{c_CholmodSparse{Tv,$Ti}}}, Ptr{UInt8}), aa, cm) CholmodSparse(aa[2]) end function CholmodDense{Tv<:CHMVTypes}(A::CholmodSparse{Tv,$Ti}) CholmodDense(ccall((@chm_nm "sparse_to_dense" $Ti ,:libcholmod), Ptr{c_CholmodDense{Tv,$Ti}}, - (Ptr{c_CholmodSparse{Tv,Ti}},Ptr{Uint8}), + (Ptr{c_CholmodSparse{Tv,Ti}},Ptr{UInt8}), &A.c,cmn($Ti))) end function CholmodSparse{Tv<:CHMVTypes}(D::CholmodDense{Tv},i::$Ti) CholmodSparse(ccall((@chm_nm "dense_to_sparse" $Ti ,:libcholmod), Ptr{c_CholmodSparse{Tv,$Ti}}, - (Ptr{c_CholmodDense{Tv,$Ti}},Ptr{Uint8}), + (Ptr{c_CholmodDense{Tv,$Ti}},Ptr{UInt8}), &D.c,cmn($Ti))) end function CholmodSparse{Tv<:CHMVTypes}(L::CholmodFactor{Tv,$Ti}) if bool(L.c.is_ll) return CholmodSparse(ccall((@chm_nm "factor_to_sparse" $Ti ,:libcholmod), Ptr{c_CholmodSparse{Tv,$Ti}}, - (Ptr{c_CholmodFactor{Tv,$Ti}},Ptr{Uint8}), + (Ptr{c_CholmodFactor{Tv,$Ti}},Ptr{UInt8}), &L.c,cmn($Ti))) end cm = cmn($Ti) Lcll = ccall((@chm_nm "copy_factor" $Ti ,:libcholmod), Ptr{c_CholmodFactor{Tv,$Ti}}, - (Ptr{c_CholmodFactor{Tv,$Ti}},Ptr{Uint8}), + (Ptr{c_CholmodFactor{Tv,$Ti}},Ptr{UInt8}), &L.c,cm) @isok ccall((@chm_nm "change_factor" $Ti ,:libcholmod), Cint, - (Cint,Cint,Cint,Cint,Cint,Ptr{c_CholmodFactor{Tv,$Ti}},Ptr{Uint8}), + (Cint,Cint,Cint,Cint,Cint,Ptr{c_CholmodFactor{Tv,$Ti}},Ptr{UInt8}), L.c.xtype,true,L.c.is_super,true,true,Lcll,cm) val = CholmodSparse(ccall((@chm_nm "factor_to_sparse" $Ti ,:libcholmod), Ptr{c_CholmodSparse{Tv,$Ti}}, - (Ptr{c_CholmodFactor{Tv,$Ti}},Ptr{Uint8}), + (Ptr{c_CholmodFactor{Tv,$Ti}},Ptr{UInt8}), Lcll,cmn($Ti))) @isok ccall((@chm_nm "free_factor" $Ti ,:libcholmod), Cint, - (Ptr{Ptr{c_CholmodFactor{Tv,$Ti}}},Ptr{Uint8}), + (Ptr{Ptr{c_CholmodFactor{Tv,$Ti}}},Ptr{UInt8}), [Lcll],cm) val end function CholmodSparse{Tv<:CHMVTypes,Ti<:$Ti}(T::CholmodTriplet{Tv,Ti}) CholmodSparse(ccall((@chm_nm "triplet_to_sparse" $Ti ,:libcholmod), Ptr{c_CholmodSparse{Tv,Ti}}, - (Ptr{c_CholmodTriplet{Tv,Ti}},Ptr{Uint8}), + (Ptr{c_CholmodTriplet{Tv,Ti}},Ptr{UInt8}), &T.c,cmn($Ti))) end function CholmodTriplet{Tv<:CHMVTypes,Ti<:$Ti}(A::CholmodSparse{Tv,Ti}) CholmodTriplet(ccall((@chm_nm "sparse_to_triplet" $Ti ,:libcholmod), Ptr{c_CholmodTriplet{Tv,Ti}}, - (Ptr{c_CholmodSparse{Tv,Ti}},Ptr{Uint8}), + (Ptr{c_CholmodSparse{Tv,Ti}},Ptr{UInt8}), &A.c,cmn($Ti))) end function isvalid{Tv<:CHMVTypes}(L::CholmodFactor{Tv,$Ti}) bool(ccall((@chm_nm "check_factor" $Ti ,:libcholmod), Cint, - (Ptr{c_CholmodFactor{Tv,$Ti}}, Ptr{Uint8}), + (Ptr{c_CholmodFactor{Tv,$Ti}}, Ptr{UInt8}), &L.c, cmn($Ti))) end function isvalid{Tv<:CHMVTypes}(A::CholmodSparse{Tv,$Ti}) bool(ccall((@chm_nm "check_sparse" $Ti ,:libcholmod), Cint, - (Ptr{c_CholmodSparse{Tv,$Ti}}, Ptr{Uint8}), + (Ptr{c_CholmodSparse{Tv,$Ti}}, Ptr{UInt8}), &A.c, cmn($Ti))) end function isvalid{Tv<:CHMVTypes}(T::CholmodTriplet{Tv,$Ti}) bool(ccall((@chm_nm "check_triplet" $Ti ,:libcholmod), Cint, - (Ptr{c_CholmodTriplet{Tv,$Ti}}, Ptr{Uint8}), + (Ptr{c_CholmodTriplet{Tv,$Ti}}, Ptr{UInt8}), &T.c, cmn($Ti))) end function cholfact{Tv<:CHMVTypes}(A::CholmodSparse{Tv,$Ti}, ll::Bool) cm = cmn($Ti) ## may need to change final_asis as well as final_ll - if ll cm[chm_final_ll_inds] = reinterpret(Uint8, [one(Cint)]) end + if ll cm[chm_final_ll_inds] = reinterpret(UInt8, [one(Cint)]) end Lpt = ccall((@chm_nm "analyze" $Ti ,:libcholmod), Ptr{c_CholmodFactor{Tv,$Ti}}, - (Ptr{c_CholmodSparse{Tv,$Ti}}, Ptr{Uint8}), &A.c, cm) + (Ptr{c_CholmodSparse{Tv,$Ti}}, Ptr{UInt8}), &A.c, cm) @isok ccall((@chm_nm "factorize" $Ti ,:libcholmod), Cint, (Ptr{c_CholmodSparse{Tv,$Ti}}, - Ptr{c_CholmodFactor{Tv,$Ti}}, Ptr{Uint8}), + Ptr{c_CholmodFactor{Tv,$Ti}}, Ptr{UInt8}), &A.c, Lpt, cm) CholmodFactor(Lpt) end function cholfact{Tv<:CHMVTypes}(A::CholmodSparse{Tv,$Ti},beta::Tv,ll::Bool) cm = cmn($Ti) ## may need to change final_asis as well as final_ll - if ll cm[chm_final_ll_inds] = reinterpret(Uint8, [one(Cint)]) end + if ll cm[chm_final_ll_inds] = reinterpret(UInt8, [one(Cint)]) end Lpt = ccall((@chm_nm "analyze" $Ti ,:libcholmod), Ptr{c_CholmodFactor{Tv,$Ti}}, - (Ptr{c_CholmodSparse{Tv,$Ti}}, Ptr{Uint8}), &A.c, cm) + (Ptr{c_CholmodSparse{Tv,$Ti}}, Ptr{UInt8}), &A.c, cm) @isok ccall((@chm_nm "factorize_p" $Ti ,:libcholmod), Cint, (Ptr{c_CholmodSparse{Tv,$Ti}}, Ptr{Tv}, Ptr{Cint}, Csize_t, - Ptr{c_CholmodFactor{Tv,$Ti}}, Ptr{Uint8}), + Ptr{c_CholmodFactor{Tv,$Ti}}, Ptr{UInt8}), &A.c, &beta, C_NULL, zero(Csize_t), Lpt, cmn($Ti)) CholmodFactor(Lpt) end function chm_analyze{Tv<:CHMVTypes}(A::CholmodSparse{Tv,$Ti}) CholmodFactor(ccall((@chm_nm "analyze" $Ti ,:libcholmod), Ptr{c_CholmodFactor{Tv,$Ti}}, - (Ptr{c_CholmodSparse{Tv,$Ti}}, Ptr{Uint8}), &A.c, cmn($Ti))) + (Ptr{c_CholmodSparse{Tv,$Ti}}, Ptr{UInt8}), &A.c, cmn($Ti))) end function cholfact!{Tv<:CHMVTypes}(L::CholmodFactor{Tv,$Ti},A::CholmodSparse{Tv,$Ti}) @isok ccall((@chm_nm "factorize" $Ti ,:libcholmod), Cint, (Ptr{c_CholmodSparse{Tv,$Ti}}, - Ptr{c_CholmodFactor{Tv,$Ti}}, Ptr{Uint8}), + Ptr{c_CholmodFactor{Tv,$Ti}}, Ptr{UInt8}), &A.c, &L.c, cmn($Ti)) L end @@ -669,34 +669,34 @@ for Ti in (:Int32,:Int64) @isok ccall((@chm_nm "factorize_p" $Ti ,:libcholmod), Cint, (Ptr{c_CholmodSparse{Tv,$Ti}}, Ptr{Tv}, Ptr{Cint}, Csize_t, - Ptr{c_CholmodFactor{Tv,$Ti}}, Ptr{Uint8}), + Ptr{c_CholmodFactor{Tv,$Ti}}, Ptr{UInt8}), &A.c, &beta, C_NULL, zero(Csize_t), &L.c, cmn($Ti)) L end function chm_pack!{Tv<:CHMVTypes}(L::CholmodFactor{Tv,$Ti}) @isok ccall((@chm_nm "pack_factor" $Ti ,:libcholmod), Cint, - (Ptr{c_CholmodFactor{Tv,$Ti}}, Ptr{Uint8}), + (Ptr{c_CholmodFactor{Tv,$Ti}}, Ptr{UInt8}), &L.c,cmn($Ti)) L end function chm_print{Tv<:CHMVTypes}(L::CholmodFactor{Tv,$Ti},lev,nm) cm = cmn($Ti) orig = cm[chm_prt_inds] - cm[chm_prt_inds] = reinterpret(Uint8, [int32(lev)]) + cm[chm_prt_inds] = reinterpret(UInt8, [int32(lev)]) @isok ccall((@chm_nm "print_factor" $Ti ,:libcholmod), Cint, - (Ptr{c_CholmodFactor{Tv,$Ti}}, Ptr{Uint8}, Ptr{Uint8}), + (Ptr{c_CholmodFactor{Tv,$Ti}}, Ptr{UInt8}, Ptr{UInt8}), &L.c, nm, cm) cm[chm_prt_inds] = orig end function chm_print{Tv<:CHMVTypes}(A::CholmodSparse{Tv,$Ti},lev,nm) cm = cmn($Ti) orig = cm[chm_prt_inds] - cm[chm_prt_inds] = reinterpret(Uint8, [int32(lev)]) + cm[chm_prt_inds] = reinterpret(UInt8, [int32(lev)]) @isok ccall((@chm_nm "print_sparse" $Ti ,:libcholmod), Cint, - (Ptr{c_CholmodSparse{Tv,$Ti}}, Ptr{Uint8}, Ptr{Uint8}), + (Ptr{c_CholmodSparse{Tv,$Ti}}, Ptr{UInt8}, Ptr{UInt8}), &A.c, nm, cm) cm[chm_prt_inds] = orig end @@ -706,7 +706,7 @@ for Ti in (:Int32,:Int64) @isok ccall((@chm_nm "scale" $Ti ,:libcholmod), Cint, (Ptr{c_CholmodDense{Tv}},Cint,Ptr{c_CholmodSparse{Tv,$Ti}}, - Ptr{Uint8}), &S.c, typ, &A.c, cmn($Ti)) + Ptr{UInt8}), &S.c, typ, &A.c, cmn($Ti)) A end function chm_sdmult{Tv<:CHMVTypes}(A::CholmodSparse{Tv,$Ti}, @@ -726,66 +726,66 @@ for Ti in (:Int32,:Int64) @isok ccall((@chm_nm "sdmult" $Ti ,:libcholmod), Cint, (Ptr{c_CholmodSparse{Tv,$Ti}},Cint,Ptr{Cdouble},Ptr{Cdouble}, - Ptr{c_CholmodDense{Tv}}, Ptr{c_CholmodDense{Tv}}, Ptr{Uint8}), + Ptr{c_CholmodDense{Tv}}, Ptr{c_CholmodDense{Tv}}, Ptr{UInt8}), &A.c,trans,aa,bb,&X.c,&Y.c,cmn($Ti)) Y end function chm_speye{Tv<:CHMVTypes,Ti<:$Ti}(m::Ti, n::Ti, x::Tv) CholmodSparse(ccall((@chm_nm "speye" $Ti , :libcholmod), Ptr{c_CholmodSparse{Tv,$Ti}}, - (Int, Int, Cint, Ptr{Uint8}), + (Int, Int, Cint, Ptr{UInt8}), m, n, xtyp(Tv), cmn($Ti))) end function chm_spzeros{Tv<:Union(Float64,Complex128)}(m::$Ti, n::$Ti, nzmax::$Ti, x::Tv) CholmodSparse(ccall((@chm_nm "spzeros" $Ti , :libcholmod), Ptr{c_CholmodSparse{Tv,$Ti}}, - (Int, Int, Int, Cint, Ptr{Uint8}), + (Int, Int, Int, Cint, Ptr{UInt8}), m, n, nzmax, xtyp(Tv), cmn($Ti))) end ## add chm_xtype and chm_pack function copy{Tv<:CHMVTypes}(L::CholmodFactor{Tv,$Ti}) CholmodFactor(ccall((@chm_nm "copy_factor" $Ti ,:libcholmod), Ptr{c_CholmodFactor{Tv,$Ti}}, - (Ptr{c_CholmodFactor{Tv,$Ti}},Ptr{Uint8}), &L.c, cmn($Ti))) + (Ptr{c_CholmodFactor{Tv,$Ti}},Ptr{UInt8}), &L.c, cmn($Ti))) end function copy{Tv<:CHMVTypes}(A::CholmodSparse{Tv,$Ti}) CholmodSparse(ccall((@chm_nm "copy_sparse" $Ti ,:libcholmod), Ptr{c_CholmodSparse{Tv,$Ti}}, - (Ptr{c_CholmodSparse{Tv,$Ti}},Ptr{Uint8}), &A.c, cmn($Ti))) + (Ptr{c_CholmodSparse{Tv,$Ti}},Ptr{UInt8}), &A.c, cmn($Ti))) end function copy{Tv<:CHMVTypes}(T::CholmodTriplet{Tv,$Ti}) CholmodTriplet(ccall((@chm_nm "copy_triplet" $Ti ,:libcholmod), Ptr{c_CholmodTriplet{Tv,$Ti}}, - (Ptr{c_CholmodTriplet{Tv,$Ti}},Ptr{Uint8}), &T.c, cmn($Ti))) + (Ptr{c_CholmodTriplet{Tv,$Ti}},Ptr{UInt8}), &T.c, cmn($Ti))) end function ctranspose{Tv<:CHMVTypes}(A::CholmodSparse{Tv,$Ti}) CholmodSparse(ccall((@chm_nm "transpose" $Ti ,:libcholmod),Ptr{c_CholmodSparse{Tv,$Ti}}, - (Ptr{c_CholmodSparse{Tv,$Ti}}, Cint, Ptr{Uint8}), + (Ptr{c_CholmodSparse{Tv,$Ti}}, Cint, Ptr{UInt8}), &A.c, 2, cmn($Ti))) end function etree{Tv<:CHMVTypes}(A::CholmodSparse{Tv,$Ti}) tr = Array($Ti,size(A,2)) @isok ccall((@chm_nm "etree" $Ti ,:libcholmod), Cint, - (Ptr{c_CholmodSparse{Tv,$Ti}},Ptr{$Ti},Ptr{Uint8}), + (Ptr{c_CholmodSparse{Tv,$Ti}},Ptr{$Ti},Ptr{UInt8}), &A.c,tr,cmn($Ti)) tr end function hcat{Tv<:CHMVTypes}(A::CholmodSparse{Tv,$Ti},B::CholmodSparse{Tv,$Ti}) ccall((@chm_nm "horzcat" $Ti , :libcholmod), Ptr{c_CholmodSparse{Tv,$Ti}}, - (Ptr{c_CholmodSparse{Tv,$Ti}},Ptr{c_CholmodSparse{Tv,$Ti}},Cint,Ptr{Uint8}), + (Ptr{c_CholmodSparse{Tv,$Ti}},Ptr{c_CholmodSparse{Tv,$Ti}},Cint,Ptr{UInt8}), &A.c,&B.c,true,cmn($Ti)) end function nnz{Tv<:CHMVTypes}(A::CholmodSparse{Tv,$Ti}) ccall((@chm_nm "nnz" $Ti - ,:libcholmod), Int, (Ptr{c_CholmodSparse{Tv,$Ti}},Ptr{Uint8}),&A.c,cmn($Ti)) + ,:libcholmod), Int, (Ptr{c_CholmodSparse{Tv,$Ti}},Ptr{UInt8}),&A.c,cmn($Ti)) end function norm{Tv<:CHMVTypes}(A::CholmodSparse{Tv,$Ti},p::Real) ccall((@chm_nm "norm_sparse" $Ti , :libcholmod), Float64, - (Ptr{c_CholmodSparse{Tv,$Ti}}, Cint, Ptr{Uint8}), + (Ptr{c_CholmodSparse{Tv,$Ti}}, Cint, Ptr{UInt8}), &A.c,p == 1 ? 1 :(p == Inf ? 1 : throw(ArgumentError("p must be 1 or Inf"))),cmn($Ti)) end function solve{Tv<:CHMVTypes}(L::CholmodFactor{Tv,$Ti}, @@ -794,7 +794,7 @@ for Ti in (:Int32,:Int64) CholmodDense(ccall((@chm_nm "solve" $Ti ,:libcholmod), Ptr{c_CholmodDense{Tv}}, (Cint, Ptr{c_CholmodFactor{Tv,$Ti}}, - Ptr{c_CholmodDense{Tv}}, Ptr{Uint8}), + Ptr{c_CholmodDense{Tv}}, Ptr{UInt8}), typ, &L.c, &B.c, cmn($Ti))) end function solve{Tv<:CHMVTypes}(L::CholmodFactor{Tv,$Ti}, @@ -804,32 +804,32 @@ for Ti in (:Int32,:Int64) CholmodSparse(ccall((@chm_nm "spsolve" $Ti ,:libcholmod), Ptr{c_CholmodSparse{Tv,$Ti}}, (Cint, Ptr{c_CholmodFactor{Tv,$Ti}}, - Ptr{c_CholmodSparse{Tv,$Ti}}, Ptr{Uint8}), + Ptr{c_CholmodSparse{Tv,$Ti}}, Ptr{UInt8}), typ, &L.c, &B.c, cmn($Ti))) end function sort!{Tv<:CHMVTypes}(A::CholmodSparse{Tv,$Ti}) @isok ccall((@chm_nm "sort" $Ti ,:libcholmod), Cint, - (Ptr{c_CholmodSparse{Tv,$Ti}}, Ptr{Uint8}), + (Ptr{c_CholmodSparse{Tv,$Ti}}, Ptr{UInt8}), &A.c, cmn($Ti)) A end function copysym{Tv<:CHMVTypes}(A::CholmodSparse{Tv,$Ti}) CholmodSparse(ccall((@chm_nm "copy" $Ti ,:libcholmod),Ptr{c_CholmodSparse{Tv,$Ti}}, - (Ptr{c_CholmodSparse{Tv,$Ti}},Cint,Cint,Ptr{Uint8}), + (Ptr{c_CholmodSparse{Tv,$Ti}},Cint,Cint,Ptr{UInt8}), &A.c,0,1,cmn($Ti))) end function transpose{Tv<:CHMVTypes}(A::CholmodSparse{Tv,$Ti}) CholmodSparse(ccall((@chm_nm "transpose" $Ti ,:libcholmod),Ptr{c_CholmodSparse{Tv,$Ti}}, - (Ptr{c_CholmodSparse{Tv,$Ti}}, Cint, Ptr{Uint8}), + (Ptr{c_CholmodSparse{Tv,$Ti}}, Cint, Ptr{UInt8}), &A.c, 1, cmn($Ti))) end function vcat{Tv<:CHMVTypes}(A::CholmodSparse{Tv,$Ti},B::CholmodSparse{Tv,$Ti}) ccall((@chm_nm "vertcat" $Ti , :libcholmod), Ptr{c_CholmodSparse{Tv,$Ti}}, - (Ptr{c_CholmodSparse{Tv,$Ti}},Ptr{c_CholmodSparse{Tv,$Ti}},Cint,Ptr{Uint8}), + (Ptr{c_CholmodSparse{Tv,$Ti}},Ptr{c_CholmodSparse{Tv,$Ti}},Cint,Ptr{UInt8}), &A.c,&B.c,true,cmn($Ti)) end end diff --git a/base/linalg/lapack.jl b/base/linalg/lapack.jl index 9e8ac8834e2a3..10677bf91acbf 100644 --- a/base/linalg/lapack.jl +++ b/base/linalg/lapack.jl @@ -1209,7 +1209,7 @@ for (geevx, ggev, elty) in info = Array(BlasInt, 1) for i = 1:2 ccall(($(blasfunc(geevx)), liblapack), Void, - (Ptr{Uint8}, Ptr{Uint8}, Ptr{Uint8}, Ptr{Uint8}, + (Ptr{UInt8}, Ptr{UInt8}, Ptr{UInt8}, Ptr{UInt8}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, @@ -1314,7 +1314,7 @@ for (geevx, ggev, elty, relty) in info = Array(BlasInt, 1) for i = 1:2 ccall(($(blasfunc(geevx)), liblapack), Void, - (Ptr{Uint8}, Ptr{Uint8}, Ptr{Uint8}, Ptr{Uint8}, + (Ptr{UInt8}, Ptr{UInt8}, Ptr{UInt8}, Ptr{UInt8}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$relty}, Ptr{$relty}, @@ -3234,7 +3234,7 @@ for (gecon, elty) in iwork = Array(BlasInt, n) info = Array(BlasInt, 1) ccall(($(blasfunc(gecon)), liblapack), Void, - (Ptr{Uint8}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, + (Ptr{UInt8}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}, Ptr{$elty}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}), &normtype, &n, A, &lda, &anorm, rcond, work, iwork, diff --git a/base/linalg/matmul.jl b/base/linalg/matmul.jl index 364c7f1c283b3..1af6d5281ee01 100644 --- a/base/linalg/matmul.jl +++ b/base/linalg/matmul.jl @@ -358,9 +358,9 @@ function generic_matmatmul{T,S}(tA, tB, A::AbstractVecOrMat{T}, B::AbstractMatri end const tilebufsize = 10800 # Approximately 32k/3 -const Abuf = Array(Uint8, tilebufsize) -const Bbuf = Array(Uint8, tilebufsize) -const Cbuf = Array(Uint8, tilebufsize) +const Abuf = Array(UInt8, tilebufsize) +const Bbuf = Array(UInt8, tilebufsize) +const Cbuf = Array(UInt8, tilebufsize) function generic_matmatmul!{T,S,R}(C::AbstractVecOrMat{R}, tA, tB, A::AbstractVecOrMat{T}, B::AbstractVecOrMat{S}) mA, nA = lapack_size(tA, A) diff --git a/base/loading.jl b/base/loading.jl index d9d63d0fa5f58..887c68ee9140a 100644 --- a/base/loading.jl +++ b/base/loading.jl @@ -95,7 +95,7 @@ end # remote/parallel load include_string(txt::AbstractString, fname::AbstractString) = - ccall(:jl_load_file_string, Any, (Ptr{Uint8},Ptr{Uint8}), txt, fname) + ccall(:jl_load_file_string, Any, (Ptr{UInt8},Ptr{UInt8}), txt, fname) include_string(txt::AbstractString) = include_string(txt, "string") diff --git a/base/math.jl b/base/math.jl index be4479b40a427..413a7901d36ff 100644 --- a/base/math.jl +++ b/base/math.jl @@ -206,12 +206,12 @@ ldexp(x::Float32,e::Int) = ccall((:scalbnf,libm), Float32, (Float32,Int32), x, i # TODO: vectorize ldexp function frexp(x::Float64) - xu = reinterpret(Uint64,x) + xu = reinterpret(UInt64,x) k = int(xu >> 52) & 0x07ff if k == 0 # x is subnormal x == zero(x) && return x,0 x *= 1.8014398509481984e16 # 0x1p54, normalise significand - xu = reinterpret(Uint64,x) + xu = reinterpret(UInt64,x) k = int(xu >> 52) & 0x07ff - 54 elseif k == 0x07ff # NaN or Inf return x,0 @@ -221,12 +221,12 @@ function frexp(x::Float64) reinterpret(Float64,xu), k end function frexp(x::Float32) - xu = reinterpret(Uint32,x) + xu = reinterpret(UInt32,x) k = int(xu >> 23) & 0x00ff if k == 0 # x is subnormal x == zero(x) && return x,0 x *= 3.3554432f7 # 0x1p25: no Float32 hex literal - xu = reinterpret(Uint32,x) + xu = reinterpret(UInt32,x) k = int(xu >> 23) & 0x00ff - 25 elseif k == 0x00ff # NaN or Inf return x,0 diff --git a/base/mmap.jl b/base/mmap.jl index cc7ebf2783ccd..3298c2f32b5da 100644 --- a/base/mmap.jl +++ b/base/mmap.jl @@ -11,7 +11,7 @@ mmap_bitarray{N}(::Type{Bool}, dims::NTuple{N,Integer}, s::IOStream, offset::Fil mmap_bitarray{N}(::Type{Bool}, dims::NTuple{N,Integer}, s::IOStream) = mmap_bitarray(dims, s, position(s)) mmap_bitarray{N}(dims::NTuple{N,Integer}, s::IOStream) = mmap_bitarray(dims, s, position(s)) -msync(B::BitArray) = msync(pointer(B.chunks), length(B.chunks)*sizeof(Uint64)) +msync(B::BitArray) = msync(pointer(B.chunks), length(B.chunks)*sizeof(UInt64)) ### UNIX implementation ### @@ -52,7 +52,7 @@ function mmap_grow(len::Integer, prot::Integer, flags::Integer, fd::Integer, off filelen = ccall(:jl_lseek, FileOffset, (Cint, FileOffset, Cint), fd, 0, SEEK_END) systemerror("lseek", filelen < 0) if (filelen < offset + len) - systemerror("pwrite", ccall(:jl_pwrite, Cssize_t, (Cint, Ptr{Void}, Uint, FileOffset), fd, int8([0]), 1, offset + len - 1) < 1) + systemerror("pwrite", ccall(:jl_pwrite, Cssize_t, (Cint, Ptr{Void}, UInt, FileOffset), fd, int8([0]), 1, offset + len - 1) < 1) end cpos = ccall(:jl_lseek, FileOffset, (Cint, FileOffset, Cint), fd, cpos, SEEK_SET) systemerror("lseek", cpos < 0) @@ -138,14 +138,14 @@ function mmap_array{T,N}(::Type{T}, dims::NTuple{N,Integer}, s::IO, offset::File offset_page::FileOffset = div(offset, granularity)*granularity szfile = convert(Csize_t, len + offset) szarray = szfile - convert(Csize_t, offset_page) - mmaphandle = ccall(:CreateFileMappingW, stdcall, Ptr{Void}, (Ptr{Void}, Ptr{Void}, Cint, Cint, Cint, Ptr{Uint16}), - shandle.handle, C_NULL, flprotect, szfile>>32, szfile&typemax(Uint32), C_NULL) + mmaphandle = ccall(:CreateFileMappingW, stdcall, Ptr{Void}, (Ptr{Void}, Ptr{Void}, Cint, Cint, Cint, Ptr{UInt16}), + shandle.handle, C_NULL, flprotect, szfile>>32, szfile&typemax(UInt32), C_NULL) if mmaphandle == C_NULL error("could not create file mapping: $(FormatMessage())") end access = ro ? 4 : 2 viewhandle = ccall(:MapViewOfFile, stdcall, Ptr{Void}, (Ptr{Void}, Cint, Cint, Cint, Csize_t), - mmaphandle, access, offset_page>>32, offset_page&typemax(Uint32), szarray) + mmaphandle, access, offset_page>>32, offset_page&typemax(UInt32), szarray) if viewhandle == C_NULL error("could not create mapping view: $(FormatMessage())") end @@ -185,7 +185,7 @@ function mmap_bitarray{N}(dims::NTuple{N,Integer}, s::IOStream, offset::FileOffs if nc > typemax(Int) error("file is too large to memory-map on this platform") end - chunks = mmap_array(Uint64, (nc,), s, offset) + chunks = mmap_array(UInt64, (nc,), s, offset) if iswrite chunks[end] &= @_msk_end n else diff --git a/base/mpfr.jl b/base/mpfr.jl index b952694ab218d..0bbf107ece02f 100644 --- a/base/mpfr.jl +++ b/base/mpfr.jl @@ -72,7 +72,7 @@ end function BigFloat(x::AbstractString, base::Int) z = BigFloat() - err = ccall((:mpfr_set_str, :libmpfr), Int32, (Ptr{BigFloat}, Ptr{Uint8}, Int32, Int32), &z, x, base, ROUNDING_MODE[end]) + err = ccall((:mpfr_set_str, :libmpfr), Int32, (Ptr{BigFloat}, Ptr{UInt8}, Int32, Int32), &z, x, base, ROUNDING_MODE[end]) if err != 0; error("incorrectly formatted number"); end return z end @@ -81,7 +81,7 @@ BigFloat(x::AbstractString) = BigFloat(x, 10) BigFloat(x::Integer) = BigFloat(BigInt(x)) BigFloat(x::Union(Bool,Int8,Int16,Int32)) = BigFloat(convert(Clong,x)) -BigFloat(x::Union(Uint8,Uint16,Uint32)) = BigFloat(convert(Culong,x)) +BigFloat(x::Union(UInt8,UInt16,UInt32)) = BigFloat(convert(Culong,x)) BigFloat(x::Union(Float16,Float32)) = BigFloat(float64(x)) BigFloat(x::Rational) = BigFloat(num(x)) / BigFloat(den(x)) @@ -101,7 +101,7 @@ for to in (Int8, Int16, Int32, Int64) end end -for to in (Uint8, Uint16, Uint32, Uint64) +for to in (UInt8, UInt16, UInt32, UInt64) @eval begin function convert(::Type{$to}, x::BigFloat) (isinteger(x) && (typemin($to) <= x <= typemax($to))) || throw(InexactError()) @@ -708,8 +708,8 @@ end function string(x::BigFloat) lng = 128 for i = 1:2 - z = Array(Uint8, lng + 1) - lng = ccall((:mpfr_snprintf,:libmpfr), Int32, (Ptr{Uint8}, Culong, Ptr{Uint8}, Ptr{BigFloat}...), z, lng + 1, "%.Re", &x) + z = Array(UInt8, lng + 1) + lng = ccall((:mpfr_snprintf,:libmpfr), Int32, (Ptr{UInt8}, Culong, Ptr{UInt8}, Ptr{BigFloat}...), z, lng + 1, "%.Re", &x) if lng < 128 || i == 2 return bytestring(z[1:lng]) end diff --git a/base/multi.jl b/base/multi.jl index bf74b39368e73..abc6ac7a97c0b 100644 --- a/base/multi.jl +++ b/base/multi.jl @@ -81,7 +81,7 @@ abstract ClusterManager type Worker host::ByteString - port::Uint16 + port::UInt16 socket::TCPSocket sendbuf::IOBuffer del_msgs::Array{Any,1} @@ -188,7 +188,7 @@ end type LocalProcess id::Int bind_addr::IPAddr - bind_port::Uint16 + bind_port::UInt16 LocalProcess() = new(1) end @@ -437,7 +437,7 @@ type RemoteRef next_id() = (id=(myid(),REQ_ID); REQ_ID+=1; id) end -hash(r::RemoteRef, h::Uint) = hash(r.whence, hash(r.id, h)) +hash(r::RemoteRef, h::UInt) = hash(r.whence, hash(r.id, h)) ==(r::RemoteRef, s::RemoteRef) = (r.whence==s.whence && r.id==s.id) rr2id(r::RemoteRef) = (r.whence, r.id) diff --git a/base/multidimensional.jl b/base/multidimensional.jl index a12554d20dc41..29c451c8ac5fe 100644 --- a/base/multidimensional.jl +++ b/base/multidimensional.jl @@ -517,13 +517,13 @@ end # TODO: this doesn't fit into the new hashing scheme in any obvious way immutable Prehashed - hash::Uint + hash::UInt end hash(x::Prehashed) = x.hash @ngenerate N typeof(A) function unique{T,N}(A::AbstractArray{T,N}, dim::Int) 1 <= dim <= N || return copy(A) - hashes = zeros(Uint, size(A, dim)) + hashes = zeros(UInt, size(A, dim)) # Compute hash for each row k = 0 diff --git a/base/multimedia.jl b/base/multimedia.jl index d1844086c3c1f..3c229436fe504 100644 --- a/base/multimedia.jl +++ b/base/multimedia.jl @@ -45,12 +45,12 @@ mimewritable(m::AbstractString, x) = mimewritable(MIME(m), x) # MIME types are assumed to be binary data except for a set of types known # to be text data (possibly Unicode). istext(m) returns whether # m::MIME is text data, and reprmime(m, x) returns x written to either -# a string (for text m::MIME) or a Vector{Uint8} (for binary m::MIME), +# a string (for text m::MIME) or a Vector{UInt8} (for binary m::MIME), # assuming the corresponding write_mime method exists. stringmime # is like reprmime except that it always returns a string, which in the # case of binary data is Base64-encoded. # -# Also, if reprmime is passed a AbstractString for a text type or Vector{Uint8} for +# Also, if reprmime is passed a AbstractString for a text type or Vector{UInt8} for # a binary type, the argument is assumed to already be in the corresponding # format and is returned unmodified. This is useful so that raw data can be # passed to display(m::MIME, x). @@ -59,9 +59,9 @@ macro textmime(mime) quote mimeT = MIME{symbol($mime)} # avoid method ambiguities with the general definitions below: - # (Q: should we treat Vector{Uint8} as a bytestring?) - Base.Multimedia.reprmime(m::mimeT, x::Vector{Uint8}) = sprint(writemime, m, x) - Base.Multimedia.stringmime(m::mimeT, x::Vector{Uint8}) = reprmime(m, x) + # (Q: should we treat Vector{UInt8} as a bytestring?) + Base.Multimedia.reprmime(m::mimeT, x::Vector{UInt8}) = sprint(writemime, m, x) + Base.Multimedia.stringmime(m::mimeT, x::Vector{UInt8}) = reprmime(m, x) Base.Multimedia.istext(::mimeT) = true if $(mime != "text/plain") # strings are shown escaped for text/plain @@ -78,9 +78,9 @@ function reprmime(m::MIME, x) writemime(s, m, x) takebuf_array(s) end -reprmime(m::MIME, x::Vector{Uint8}) = x +reprmime(m::MIME, x::Vector{UInt8}) = x stringmime(m::MIME, x) = base64(writemime, m, x) -stringmime(m::MIME, x::Vector{Uint8}) = base64(write, x) +stringmime(m::MIME, x::Vector{UInt8}) = base64(write, x) # it is convenient to accept strings instead of ::MIME istext(m::AbstractString) = istext(MIME(m)) diff --git a/base/nullable.jl b/base/nullable.jl index 81b79292a6721..d886f81c311e6 100644 --- a/base/nullable.jl +++ b/base/nullable.jl @@ -41,9 +41,9 @@ end =={S, T}(x::Nullable{S}, y::Nullable{T}) = throw(NullException()) -const nullablehash_seed = Uint === Uint64 ? 0x932e0143e51d0171 : 0xe51d0171 +const nullablehash_seed = UInt === UInt64 ? 0x932e0143e51d0171 : 0xe51d0171 -function hash(x::Nullable, h::Uint) +function hash(x::Nullable, h::UInt) if x.isnull return h + nullablehash_seed else diff --git a/base/operators.jl b/base/operators.jl index 75153161a573c..8fca91a010b4c 100644 --- a/base/operators.jl +++ b/base/operators.jl @@ -415,7 +415,7 @@ next(p::Pair, i) = (getfield(p,i), i+1) indexed_next(p::Pair, i::Int, state) = (getfield(p,i), i+1) -hash(p::Pair, h::Uint) = hash(p.second, hash(p.first, h)) +hash(p::Pair, h::UInt) = hash(p.second, hash(p.first, h)) ==(p::Pair, q::Pair) = (p.first==q.first) & (p.second==q.second) isequal(p::Pair, q::Pair) = isequal(p.first,q.first) & isequal(p.second,q.second) diff --git a/base/osutils.jl b/base/osutils.jl index 04085b368a4ae..9d7a15434c1b1 100644 --- a/base/osutils.jl +++ b/base/osutils.jl @@ -48,7 +48,7 @@ end # Windows version macros @windows_only function windows_version() - verinfo = ccall(:GetVersion, Uint32, ()) + verinfo = ccall(:GetVersion, UInt32, ()) (verinfo & 0xFF, (verinfo >> 8) & 0xFF) end @unix_only windows_version() = (0,0) diff --git a/base/path.jl b/base/path.jl index abb6807cf4499..2cd634cf7e6fd 100644 --- a/base/path.jl +++ b/base/path.jl @@ -111,9 +111,9 @@ abspath(a::AbstractString, b::AbstractString...) = abspath(joinpath(a,b...)) p = uint32((sizeof(path)>>2) + 1) while true buflength = p - buf = zeros(Uint16,buflength) + buf = zeros(UInt16,buflength) p = ccall((:GetFullPathNameW, "Kernel32"), stdcall, - Uint32, (Ptr{Uint16}, Uint32, Ptr{Uint16}, Ptr{Void}), + UInt32, (Ptr{UInt16}, UInt32, Ptr{UInt16}, Ptr{Void}), path, buflength, buf, C_NULL) systemerror(:realpath, p == 0) if (p < buflength) @@ -124,7 +124,7 @@ abspath(a::AbstractString, b::AbstractString...) = abspath(joinpath(a,b...)) end @unix_only function realpath(path::AbstractString) - p = ccall(:realpath, Ptr{Uint8}, (Ptr{Uint8}, Ptr{Uint8}), path, C_NULL) + p = ccall(:realpath, Ptr{UInt8}, (Ptr{UInt8}, Ptr{UInt8}), path, C_NULL) systemerror(:realpath, p == C_NULL) s = bytestring(p) c_free(p) diff --git a/base/pcre.jl b/base/pcre.jl index a36a0236ba2e9..e60628f6643c6 100644 --- a/base/pcre.jl +++ b/base/pcre.jl @@ -4,7 +4,7 @@ module PCRE include("pcre_h.jl") -const VERSION = bytestring(ccall((:pcre_version, :libpcre), Ptr{Uint8}, ())) +const VERSION = bytestring(ccall((:pcre_version, :libpcre), Ptr{UInt8}, ())) global JIT_STACK = C_NULL function __init__() @@ -57,9 +57,9 @@ function info{T}( regex::Ptr{Void}, extra::Ptr{Void}, what::Integer, ::Type{T} ) - buf = Array(Uint8,sizeof(T)) + buf = Array(UInt8,sizeof(T)) ret = ccall((:pcre_fullinfo, :libpcre), Int32, - (Ptr{Void}, Ptr{Void}, Int32, Ptr{Uint8}), + (Ptr{Void}, Ptr{Void}, Int32, Ptr{UInt8}), regex, extra, what, buf) if ret != 0 error(ret == ERROR_NULL ? "NULL regex object" : @@ -71,9 +71,9 @@ function info{T}( end function config{T}(what::Integer, ::Type{T}) - buf = Array(Uint8, sizeof(T)) + buf = Array(UInt8, sizeof(T)) ret = ccall((:pcre_config, :libpcre), Int32, - (Int32, Ptr{Uint8}), + (Int32, Ptr{UInt8}), what, buf) if ret != 0 @@ -83,10 +83,10 @@ function config{T}(what::Integer, ::Type{T}) end function compile(pattern::AbstractString, options::Integer) - errstr = Array(Ptr{Uint8},1) + errstr = Array(Ptr{UInt8},1) erroff = Array(Int32,1) re_ptr = ccall((:pcre_compile, :libpcre), Ptr{Void}, - (Ptr{Uint8}, Int32, Ptr{Ptr{Uint8}}, Ptr{Int32}, Ptr{Uint8}), + (Ptr{UInt8}, Int32, Ptr{Ptr{UInt8}}, Ptr{Int32}, Ptr{UInt8}), pattern, options, errstr, erroff, C_NULL) if re_ptr == C_NULL error("$(bytestring(errstr[1]))", @@ -99,9 +99,9 @@ end function study(regex::Ptr{Void}, options::Integer) # NOTE: options should always be zero in current PCRE - errstr = Array(Ptr{Uint8},1) + errstr = Array(Ptr{UInt8},1) extra = ccall((:pcre_study, :libpcre), Ptr{Void}, - (Ptr{Void}, Int32, Ptr{Ptr{Uint8}}), + (Ptr{Void}, Int32, Ptr{Ptr{UInt8}}), regex, options, errstr) if errstr[1] != C_NULL error("$(bytestring(errstr[1]))") @@ -139,7 +139,7 @@ function exec(regex::Ptr{Void}, extra::Ptr{Void}, error(BoundsError) end n = ccall((:pcre_exec, :libpcre), Int32, - (Ptr{Void}, Ptr{Void}, Ptr{Uint8}, Int32, + (Ptr{Void}, Ptr{Void}, Ptr{UInt8}, Int32, Int32, Int32, Ptr{Int32}, Int32), regex, extra, pointer(str.data,shift+1), len, offset, options, ovec, length(ovec)) diff --git a/base/pkg/types.jl b/base/pkg/types.jl index cfd3390cd3e1c..2a207e59aa978 100644 --- a/base/pkg/types.jl +++ b/base/pkg/types.jl @@ -44,7 +44,7 @@ function intersect(A::VersionSet, B::VersionSet) VersionSet(ivals) end ==(A::VersionSet, B::VersionSet) = A.intervals == B.intervals -hash(s::VersionSet, h::Uint) = hash(s.intervals, h + (0x2fd2ca6efa023f44 % Uint)) +hash(s::VersionSet, h::UInt) = hash(s.intervals, h + (0x2fd2ca6efa023f44 % UInt)) deepcopy_internal(vs::VersionSet, ::ObjectIdDict) = VersionSet(copy(vs.intervals)) typealias Requires Dict{ByteString,VersionSet} diff --git a/base/pointer.jl b/base/pointer.jl index 78a8370938ffd..3c8cd3e3df998 100644 --- a/base/pointer.jl +++ b/base/pointer.jl @@ -3,20 +3,20 @@ const C_NULL = box(Ptr{Void}, 0) # pointer to integer -convert(::Type{Uint}, x::Ptr) = box(Uint, unbox(Ptr,x)) +convert(::Type{UInt}, x::Ptr) = box(UInt, unbox(Ptr,x)) convert{T<:Integer}(::Type{T}, x::Ptr) = convert(T,unsigned(x)) # integer to pointer -convert{T}(::Type{Ptr{T}}, x::Integer) = box(Ptr{T},unbox(Uint,uint(x))) +convert{T}(::Type{Ptr{T}}, x::Integer) = box(Ptr{T},unbox(UInt,uint(x))) # pointer to pointer convert{T}(::Type{Ptr{T}}, p::Ptr{T}) = p convert{T}(::Type{Ptr{T}}, p::Ptr) = box(Ptr{T}, unbox(Ptr,p)) # object to pointer -convert(::Type{Ptr{Uint8}}, x::Symbol) = ccall(:jl_symbol_name, Ptr{Uint8}, (Any,), x) +convert(::Type{Ptr{UInt8}}, x::Symbol) = ccall(:jl_symbol_name, Ptr{UInt8}, (Any,), x) convert(::Type{Ptr{Int8}}, x::Symbol) = ccall(:jl_symbol_name, Ptr{Int8}, (Any,), x) -convert(::Type{Ptr{Uint8}}, s::ByteString) = convert(Ptr{Uint8}, s.data) +convert(::Type{Ptr{UInt8}}, s::ByteString) = convert(Ptr{UInt8}, s.data) convert(::Type{Ptr{Int8}}, s::ByteString) = convert(Ptr{Int8}, s.data) convert{T}(::Type{Ptr{T}}, a::Array{T}) = ccall(:jl_array_ptr, Ptr{T}, (Any,), a) @@ -52,8 +52,8 @@ unsafe_store!{T}(p::Ptr{T}, x) = pointerset(p, convert(T,x), 1) unsafe_pointer_to_objref(p::Ptr) = pointertoref(unbox(Ptr{Void},p)) pointer_from_objref(x::Any) = ccall(:jl_value_ptr, Ptr{Void}, (Any,), x) -integer(x::Ptr) = convert(Uint, x) -unsigned(x::Ptr) = convert(Uint, x) +integer(x::Ptr) = convert(UInt, x) +unsigned(x::Ptr) = convert(UInt, x) eltype{T}(::Ptr{T}) = T diff --git a/base/poll.jl b/base/poll.jl index a896149ef144e..965e864e20c9a 100644 --- a/base/poll.jl +++ b/base/poll.jl @@ -5,7 +5,7 @@ type FileMonitor notify::Condition function FileMonitor(cb, file) handle = c_malloc(_sizeof_uv_fs_event) - err = ccall(:jl_fs_event_init,Int32, (Ptr{Void}, Ptr{Void}, Ptr{Uint8}, Int32), eventloop(),handle,file,0) + err = ccall(:jl_fs_event_init,Int32, (Ptr{Void}, Ptr{Void}, Ptr{UInt8}, Int32), eventloop(),handle,file,0) if err < 0 c_free(handle) throw(UVError("FileMonitor",err)) @@ -249,7 +249,7 @@ start_watching(f::Function, t::FDWatcher, events::FDEvent) = (t.cb = f; start_wa function start_watching(t::PollingFileWatcher, interval) associate_julia_struct(t.handle, t) uv_error("start_watching (File)", - ccall(:jl_fs_poll_start, Int32, (Ptr{Void},Ptr{Uint8},Uint32), + ccall(:jl_fs_poll_start, Int32, (Ptr{Void},Ptr{UInt8},UInt32), t.handle, t.file, iround(interval*1000))) end start_watching(f::Function, t::PollingFileWatcher, interval) = (t.cb = f;start_watching(t,interval)) @@ -267,7 +267,7 @@ function stop_watching(t::PollingFileWatcher) end function _uv_hook_fseventscb(t::FileMonitor,filename::Ptr,events::Int32,status::Int32) - fname = filename == C_NULL ? "" : bytestring(convert(Ptr{Uint8},filename)) + fname = filename == C_NULL ? "" : bytestring(convert(Ptr{UInt8},filename)) fe = FileEvent(events) if isa(t.cb,Function) t.cb(fname, fe, status) @@ -287,7 +287,7 @@ end function _uv_hook_fspollcb(t::PollingFileWatcher,status::Int32,prev::Ptr,cur::Ptr) if isa(t.cb,Function) - t.cb(t, StatStruct(convert(Ptr{Uint8},prev)), StatStruct(convert(Ptr{Uint8},cur)), status) + t.cb(t, StatStruct(convert(Ptr{UInt8},prev)), StatStruct(convert(Ptr{UInt8},cur)), status) end end diff --git a/base/precompile.jl b/base/precompile.jl index 3d85ccbf1340d..a27078fe87e7f 100644 --- a/base/precompile.jl +++ b/base/precompile.jl @@ -6,9 +6,9 @@ precompile(Base.PCRE.__init__, ()) precompile(Base.Random.srand, ()) precompile(Base.Random.__init__, ()) -precompile(Base.srand, (Array{Uint32,1},)) +precompile(Base.srand, (Array{UInt32,1},)) precompile(Base.Random.srand, (ASCIIString, Int)) -precompile(Base.Random.srand, (Uint,)) +precompile(Base.Random.srand, (UInt,)) precompile(!=, (Bool, Bool)) precompile(!=, (SubString{ASCIIString}, ASCIIString)) @@ -33,7 +33,7 @@ precompile(Base.BitArray, (Int,)) precompile(Base.CallStack, (Expr, Module, (Void,), Base.EmptyCallStack)) precompile(Base.Dict, ()) precompile(Base.Dict{Any,Any}, (Int,)) -precompile(Base.IOStream, (ASCIIString, Array{Uint8,1})) +precompile(Base.IOStream, (ASCIIString, Array{UInt8,1})) precompile(Base.KeyError, (Int,)) precompile(Base.LineEdit.fix_conflicts!, (Void, Int)) precompile(Base.ProcessGroup, (Int, Array{Any,1}, Array{Any,1})) @@ -46,24 +46,24 @@ precompile(Base.TTY, (Ptr{Void},)) precompile(Base.TmStruct, (Float64,)) precompile(Base.VersionNumber, (Int, Int, Int, (), (ASCIIString,))) precompile(Base._atexit, ()) -precompile(Base._deleteat!, (Array{Uint8, 1}, Int, Int)) -precompile(Base._deleteat_beg!, (Array{Uint8, 1}, Int, Int)) -precompile(Base._deleteat_end!, (Array{Uint8, 1}, Int, Int)) -precompile(Base._growat_beg!, (Array{Uint8, 1}, Int, Int)) -precompile(Base._growat_end!, (Array{Uint8, 1}, Int, Int)) +precompile(Base._deleteat!, (Array{UInt8, 1}, Int, Int)) +precompile(Base._deleteat_beg!, (Array{UInt8, 1}, Int, Int)) +precompile(Base._deleteat_end!, (Array{UInt8, 1}, Int, Int)) +precompile(Base._growat_beg!, (Array{UInt8, 1}, Int, Int)) +precompile(Base._growat_end!, (Array{UInt8, 1}, Int, Int)) precompile(Base._ieval, (Symbol,)) precompile(Base._setindex!, (Dict{Any, Any}, Base.LineEdit.PromptState, Base.LineEdit.Prompt, Int)) precompile(Base._setindex!, (Dict{Any, Any}, Bool, WeakRef, Int)) -precompile(Base._setindex!, (Dict{Uint8, Any}, Base.LineEdit.Prompt, Uint8, Int)) +precompile(Base._setindex!, (Dict{UInt8, Any}, Base.LineEdit.Prompt, UInt8, Int)) precompile(Base._start, ()) -precompile(Base._uv_hook_alloc_buf, (Base.TTY, Uint)) -precompile(Base._uv_hook_readcb, (Base.TTY, Int, Ptr{Void}, Uint)) +precompile(Base._uv_hook_alloc_buf, (Base.TTY, UInt)) +precompile(Base._uv_hook_readcb, (Base.TTY, Int, Ptr{Void}, UInt)) precompile(Base._uv_hook_writecb_task, (Base.TTY, Ptr{Void}, Int32)) precompile(Base.a2t, (Array{Any,1},)) precompile(Base.abs, (Char,)) precompile(Base.abspath, (ASCIIString, ASCIIString)) precompile(Base.abstract_eval, (LambdaStaticData, ObjectIdDict, Base.StaticVarInfo)) -precompile(Base.abstract_eval_arg, (Uint8, ObjectIdDict, Base.StaticVarInfo)) +precompile(Base.abstract_eval_arg, (UInt8, ObjectIdDict, Base.StaticVarInfo)) precompile(Base.abstract_interpret, (Bool, ObjectIdDict, Base.StaticVarInfo)) precompile(Base.alignment, (Float64,)) precompile(Base.any, (Function, Array{Any,1})) @@ -91,7 +91,7 @@ precompile(Base.convert, (Type{Module}, Module)) precompile(Base.copy!, (Array{Dict{Any, Any}, 1}, Int, Array{Dict{Any, Any}, 1}, Int, Int)) precompile(Base.copy, (Bool,)) precompile(Base.delete_var!, (Expr, Symbol)) -precompile(Base.deleteat!, (Array{Uint8, 1}, Base.UnitRange{Int})) +precompile(Base.deleteat!, (Array{UInt8, 1}, Base.UnitRange{Int})) precompile(Base.done, (Array{Base.LineEdit.TextInterface, 1}, Int)) precompile(Base.done, (Dict{Any,Any}, Int)) precompile(Base.done, (Dict{Symbol,Any}, Int)) @@ -123,25 +123,25 @@ precompile(Base.getindex, (Type{AbstractString},)) precompile(Base.getpid, ()) precompile(Base.hash, (Int,)) precompile(Base.hash, (RemoteRef,)) -precompile(Base.hash, (RemoteRef, Uint)) +precompile(Base.hash, (RemoteRef, UInt)) precompile(Base.haskey, (Base.EnvHash, ASCIIString)) precompile(Base.haskey, (Dict{Symbol,Any}, Symbol)) precompile(Base.haskey, (ObjectIdDict, Symbol)) precompile(Base.hex, (Char, Int)) precompile(Base.ht_keyindex, (Dict{Any, Any}, Base.LineEdit.Prompt)) precompile(Base.ht_keyindex, (Dict{Any,Any}, Int32)) -precompile(Base.ht_keyindex, (Dict{Uint8, Any}, Uint8)) +precompile(Base.ht_keyindex, (Dict{UInt8, Any}, UInt8)) precompile(Base.ht_keyindex2, (Dict{Any, Any}, Base.LineEdit.Prompt)) -precompile(Base.ht_keyindex2, (Dict{Uint8, Any}, Uint8)) +precompile(Base.ht_keyindex2, (Dict{UInt8, Any}, UInt8)) precompile(Base.in, (Char, ASCIIString)) precompile(Base.in, (Int, Base.UnitRange{Int})) -precompile(Base.in, (Uint8, Base.KeyIterator{Dict{Uint8, Any}})) +precompile(Base.in, (UInt8, Base.KeyIterator{Dict{UInt8, Any}})) precompile(Base.include_from_node1, (ASCIIString,)) precompile(Base.init_stdio, (Ptr{Void},)) precompile(Base.input_color, ()) precompile(Base.insert!, (Array{Any,1}, Int, Base.GetfieldNode)) precompile(Base.int, (Int,)) -precompile(Base.int, (Uint,)) +precompile(Base.int, (UInt,)) precompile(Base.is_var_assigned, (Expr, Symbol)) precompile(Base.isabspath, (ASCIIString,)) precompile(Base.isconstantfunc, (SymbolNode, Base.StaticVarInfo)) @@ -166,10 +166,10 @@ precompile(Base.isslotempty, (Dict{Any,Any}, Int)) precompile(Base.istaskdone, (Task,)) precompile(Base.joinpath, (ASCIIString, ASCIIString)) precompile(Base.joinpath, (ASCIIString, ASCIIString, ASCIIString)) -precompile(Base.keys, (Dict{Uint8, Any},)) +precompile(Base.keys, (Dict{UInt8, Any},)) precompile(Base.last, (UnitRange{Int},)) precompile(Base.length, (ASCIIString,)) -precompile(Base.length, (Array{Uint8,1},)) +precompile(Base.length, (Array{UInt8,1},)) precompile(Base.length, (UnitRange{Int},)) precompile(Base.match, (Regex, ASCIIString)) precompile(Base.min, (Int32, Int32)) @@ -185,7 +185,7 @@ precompile(Base.notify, (Condition, Any)) precompile(Base.notify_empty, (Base.RemoteValue,)) precompile(Base.notify_full, (Base.RemoteValue,)) precompile(Base.occurs_more, (Bool, Function, Int)) -precompile(Base.occurs_more, (Uint8, Function, Int)) +precompile(Base.occurs_more, (UInt8, Function, Int)) precompile(Base.occurs_outside_tupleref, (Function, Symbol, Base.StaticVarInfo, Int)) precompile(Base.occurs_undef, (Symbol, Expr)) precompile(Base.open, (ASCIIString, ASCIIString)) @@ -223,13 +223,13 @@ precompile(Base.pushdisplay, (Base.Multimedia.TextDisplay,)) precompile(Base.pwd, ()) precompile(Base.read, (Base.Terminals.TTYTerminal, Type{Char})) precompile(Base.read, (IOBuffer, Type{Char})) -precompile(Base.read, (IOBuffer, Type{Uint8})) -precompile(Base.read, (IOStream, Array{Uint32,1})) +precompile(Base.read, (IOBuffer, Type{UInt8})) +precompile(Base.read, (IOStream, Array{UInt32,1})) precompile(Base.readline, (ASCIIString,)) precompile(Base.readuntil, (IOBuffer, Char)) -precompile(Base.readuntil, (IOBuffer, Uint8)) +precompile(Base.readuntil, (IOBuffer, UInt8)) precompile(Base.rehash, (Dict{Any,Any}, Int)) -precompile(Base.rehash, (Dict{Uint8, Any}, Int)) +precompile(Base.rehash, (Dict{UInt8, Any}, Int)) precompile(Base.reinit_stdio, ()) precompile(Base.repeat, (ASCIIString, Int)) precompile(Base.repl_callback, (Expr, Int)) @@ -239,10 +239,10 @@ precompile(Base.rsearch, (ASCIIString, Char)) precompile(Base.rstrip, (ASCIIString,)) precompile(Base.run, (Cmd,)) precompile(Base.search, (ASCIIString, Regex, Int)) -precompile(Base.search, (IOBuffer, Uint8)) +precompile(Base.search, (IOBuffer, UInt8)) precompile(Base.seek, (IOBuffer, Int)) precompile(Base.seekend, (IOStream,)) -precompile(Base.setindex!, (Array{Any, 1}, Array{Uint8, 1}, Int)) +precompile(Base.setindex!, (Array{Any, 1}, Array{UInt8, 1}, Int)) precompile(Base.setindex!, (Array{Any, 1}, Base.NewvarNode, Int)) precompile(Base.setindex!, (Array{Any, 1}, GetfieldNode, Int)) precompile(Base.setindex!, (Array{Any,1}, WeakRef, Int)) @@ -251,13 +251,13 @@ precompile(Base.setindex!, (Array{Base.LineEdit.TextInterface, 1}, Base.LineEdit precompile(Base.setindex!, (Array{Char, 1}, Char, Int)) precompile(Base.setindex!, (Array{AbstractString, 1}, ASCIIString, Int)) precompile(Base.setindex!, (Array{Symbol, 1}, Symbol, Int)) -precompile(Base.setindex!, (Array{Uint8,1}, Uint8, Int)) +precompile(Base.setindex!, (Array{UInt8,1}, UInt8, Int)) precompile(Base.setindex!, (BitArray{1}, Bool, Int,)) precompile(Base.setindex!, (Dict{Any, Any}, Base.LineEdit.PromptState, Base.LineEdit.Prompt)) precompile(Base.setindex!, (Dict{Any,Any}, Base.LineEdit.SearchState, Base.LineEdit.HistoryPrompt{Base.REPL.REPLHistoryProvider})) precompile(Base.setindex!, (Dict{Any,Any}, Bool, Cmd)) -precompile(Base.setindex!, (Dict{Uint8, Any}, Base.LineEdit.Prompt, Uint8)) -precompile(Base.setindex!, (Vector{Any}, Uint8, Int)) +precompile(Base.setindex!, (Dict{UInt8, Any}, Base.LineEdit.Prompt, UInt8)) +precompile(Base.setindex!, (Vector{Any}, UInt8, Int)) precompile(Base.setindex!, (Vector{Any}, Vector{Any}, Int)) precompile(Base.show, (Base.Terminals.TTYTerminal, Int)) precompile(Base.show, (Float64,)) @@ -267,7 +267,7 @@ precompile(Base.similar, (Array{Base.LineEdit.Prompt, 1}, Type{Base.LineEdit.Tex precompile(Base.size, (Base.Terminals.TTYTerminal,)) precompile(Base.sizeof, (ASCIIString,)) precompile(Base.source_path, (Void,)) -precompile(Base.splice!, (Array{Uint8, 1}, Base.UnitRange{Int}, Array{Uint8, 1})) +precompile(Base.splice!, (Array{UInt8, 1}, Base.UnitRange{Int}, Array{UInt8, 1})) precompile(Base.split, (ASCIIString, ASCIIString)) precompile(Base.split, (ASCIIString, Regex)) precompile(Base.split, (ASCIIString,)) @@ -281,7 +281,7 @@ precompile(Base.strftime, (ASCIIString, Base.TmStruct)) precompile(Base.string, (Int,)) precompile(Base.strip, (ASCIIString,)) precompile(Base.strwidth, (ASCIIString,)) -precompile(Base.sym_replace, (Uint8, Array{Any,1}, Array{Any,1}, Array{Any,1}, Array{Any,1})) +precompile(Base.sym_replace, (UInt8, Array{Any,1}, Array{Any,1}, Array{Any,1}, Array{Any,1})) precompile(Base.symbol, (SubString{UTF8String},)) precompile(Base.symequal, (Symbol, Symbol)) precompile(Base.sync_begin, ()) @@ -295,7 +295,7 @@ precompile(Base.takebuf_string, (IOBuffer,)) precompile(Base.task_local_storage, ()) precompile(Base.terminate_all_workers, ()) precompile(Base.try_include, (ASCIIString,)) -precompile(Base.uint, (Uint,)) +precompile(Base.uint, (UInt,)) precompile(Base.unsafe_copy!, (Array{Dict{Any, Any}, 1}, Int, Array{Dict{Any, Any}, 1}, Int, Int)) precompile(Base.unsafe_copy!, (Ptr{Dict{Any, Any}}, Ptr{Dict{Any, Any}}, Int)) precompile(Base.unshift!, (Array{Any,1}, Task)) @@ -310,14 +310,14 @@ precompile(Base.wait_full, (Base.RemoteValue,)) precompile(Base.work_result, (Base.RemoteValue,)) precompile(Base.write, (Base.Terminals.TTYTerminal, ASCIIString)) precompile(Base.write, (Base.Terminals.TerminalBuffer, ASCIIString)) -precompile(Base.write, (IOBuffer, Vector{Uint8})) +precompile(Base.write, (IOBuffer, Vector{UInt8})) precompile(Base.writemime, (Base.Terminals.TTYTerminal, Base.Multimedia.MIME{symbol("text/plain")}, Int)) precompile(push!, (Array{Base.Multimedia.Display, 1}, Base.Multimedia.TextDisplay)) precompile(Base.Terminals.TTYTerminal, (ASCIIString, Base.TTY, Base.TTY, Base.TTY)) precompile(Base.Terminals.beep, (Base.Terminals.TTYTerminal,)) precompile(Base.Terminals.raw!, (Base.Terminals.TTYTerminal, Bool)) -precompile(Base.Terminals.write, (Base.Terminals.TTYTerminal, Array{Uint8, 1})) +precompile(Base.Terminals.write, (Base.Terminals.TTYTerminal, Array{UInt8, 1})) precompile(Base.LineEdit.Prompt, (ASCIIString, ASCIIString, ASCIIString, Function, Function, Base.REPL.LineEditREPL, Base.REPL.REPLCompletionProvider, Function, Function, Base.LineEdit.EmptyHistoryProvider, Bool)) precompile(Base.LineEdit.Prompt, (ASCIIString, ASCIIString, ASCIIString, Function, Function, Base.REPL.LineEditREPL, Base.REPL.ShellCompletionProvider, Function, Function, Base.LineEdit.EmptyHistoryProvider, Bool)) diff --git a/base/primes.jl b/base/primes.jl index 0d81c8e1325ce..c42b62d5e307c 100644 --- a/base/primes.jl +++ b/base/primes.jl @@ -57,17 +57,17 @@ end # http://primes.utm.edu/prove/merged.html # http://miller-rabin.appspot.com # -witnesses(n::Union(Uint8,Int8,Uint16,Int16)) = (2,3) -witnesses(n::Union(Uint32,Int32)) = n < 1373653 ? (2,3) : (2,7,61) -witnesses(n::Union(Uint64,Int64)) = +witnesses(n::Union(UInt8,Int8,UInt16,Int16)) = (2,3) +witnesses(n::Union(UInt32,Int32)) = n < 1373653 ? (2,3) : (2,7,61) +witnesses(n::Union(UInt64,Int64)) = n < 1373653 ? (2,3) : n < 4759123141 ? (2,7,61) : n < 2152302898747 ? (2,3,5,7,11) : n < 3474749660383 ? (2,3,5,7,11,13) : (2,325,9375,28178,450775,9780504,1795265022) -isprime(n::Uint128) = - n <= typemax(Uint64) ? isprime(uint64(n)) : isprime(BigInt(n)) +isprime(n::UInt128) = + n <= typemax(UInt64) ? isprime(uint64(n)) : isprime(BigInt(n)) isprime(n::Int128) = n < 2 ? false : n <= typemax(Int64) ? isprime(int64(n)) : isprime(BigInt(n)) diff --git a/base/printf.jl b/base/printf.jl index db6c7919ee146..dcfe7721ccf0d 100644 --- a/base/printf.jl +++ b/base/printf.jl @@ -4,7 +4,7 @@ export @printf, @sprintf ### printf formatter generation ### const SmallFloatingPoint = Union(Float64,Float32,Float16) -const SmallNumber = Union(SmallFloatingPoint,Base.Signed64,Base.Unsigned64,Uint128,Int128) +const SmallNumber = Union(SmallFloatingPoint,Base.Signed64,Base.Unsigned64,UInt128,Int128) function gen(s::AbstractString) args = [] @@ -603,7 +603,7 @@ function decode_dec(d::Integer) return int32(pt), int32(pt), neg end -function decode_hex(d::Integer, symbols::Array{Uint8,1}) +function decode_hex(d::Integer, symbols::Array{UInt8,1}) neg, x = handlenegative(d) @handle_zero x pt = i = (sizeof(x)<<1)-(leading_zeros(x)>>2) @@ -626,8 +626,8 @@ function decode(b::Int, x::BigInt) pt = Base.ndigits(x, abs(b)) length(DIGITS) < pt+1 && resize!(DIGITS, pt+1) neg && (x.size = -x.size) - ccall((:__gmpz_get_str, :libgmp), Ptr{Uint8}, - (Ptr{Uint8}, Cint, Ptr{BigInt}), DIGITS, b, &x) + ccall((:__gmpz_get_str, :libgmp), Ptr{UInt8}, + (Ptr{UInt8}, Cint, Ptr{BigInt}), DIGITS, b, &x) neg && (x.size = -x.size) return int32(pt), int32(pt), neg end @@ -645,9 +645,9 @@ function decode_0ct(x::BigInt) pt = Base.ndigits0z(x, 8) + 1 length(DIGITS) < pt+1 && resize!(DIGITS, pt+1) neg && (x.size = -x.size) - p = convert(Ptr{Uint8}, DIGITS) + 1 - ccall((:__gmpz_get_str, :libgmp), Ptr{Uint8}, - (Ptr{Uint8}, Cint, Ptr{BigInt}), p, 8, &x) + p = convert(Ptr{UInt8}, DIGITS) + 1 + ccall((:__gmpz_get_str, :libgmp), Ptr{UInt8}, + (Ptr{UInt8}, Cint, Ptr{BigInt}), p, 8, &x) neg && (x.size = -x.size) return neg, int32(pt), int32(pt) end @@ -801,7 +801,7 @@ function bigfloat_printf(out, d, flags::ASCIIString, width::Int, precision::Int, write(fmt, uint8(0)) printf_fmt = takebuf_array(fmt) @assert length(printf_fmt) == fmt_len - lng = ccall((:mpfr_snprintf,:libmpfr), Int32, (Ptr{Uint8}, Culong, Ptr{Uint8}, Ptr{BigFloat}...), DIGITS, length(DIGITS)-1, printf_fmt, &d) + lng = ccall((:mpfr_snprintf,:libmpfr), Int32, (Ptr{UInt8}, Culong, Ptr{UInt8}, Ptr{BigFloat}...), DIGITS, length(DIGITS)-1, printf_fmt, &d) lng > 0 || error("invalid printf formatting for BigFloat") write(out, pointer(DIGITS), lng) return (false, ()) diff --git a/base/process.jl b/base/process.jl index 0194f8a828b40..edad166ba5649 100644 --- a/base/process.jl +++ b/base/process.jl @@ -201,12 +201,12 @@ type ProcessChain end typealias ProcessChainOrNot Union(Bool,ProcessChain) -function _jl_spawn(cmd::Ptr{Uint8}, argv::Ptr{Ptr{Uint8}}, loop::Ptr{Void}, pp::Process, +function _jl_spawn(cmd::Ptr{UInt8}, argv::Ptr{Ptr{UInt8}}, loop::Ptr{Void}, pp::Process, in, out, err) proc = c_malloc(_sizeof_uv_process) error = ccall(:jl_spawn, Int32, - (Ptr{Uint8}, Ptr{Ptr{Uint8}}, Ptr{Void}, Ptr{Void}, Any, Int32, - Ptr{Void}, Int32, Ptr{Void}, Int32, Ptr{Void}, Int32, Ptr{Ptr{Uint8}}, Ptr{Uint8}), + (Ptr{UInt8}, Ptr{Ptr{UInt8}}, Ptr{Void}, Ptr{Void}, Any, Int32, + Ptr{Void}, Int32, Ptr{Void}, Int32, Ptr{Void}, Int32, Ptr{Ptr{UInt8}}, Ptr{UInt8}), cmd, argv, loop, proc, pp, uvtype(in), uvhandle(in), uvtype(out), uvhandle(out), uvtype(err), uvhandle(err), pp.cmd.detach, pp.cmd.env === nothing ? C_NULL : pp.cmd.env, isempty(pp.cmd.dir) ? C_NULL : pp.cmd.dir) @@ -344,7 +344,7 @@ function spawn(pc::ProcessChainOrNot, cmd::Cmd, stdios::StdIOSet, exitcb::Callba ptrs = _jl_pre_exec(cmd.exec) pp.exitcb = exitcb pp.closecb = closecb - pp.handle = _jl_spawn(ptrs[1], convert(Ptr{Ptr{Uint8}}, ptrs), loop, pp, + pp.handle = _jl_spawn(ptrs[1], convert(Ptr{Ptr{UInt8}}, ptrs), loop, pp, in, out, err) @cleanup_stdio if isa(pc, ProcessChain) @@ -567,7 +567,7 @@ function _jl_pre_exec(args::Vector{ByteString}) if length(args) < 1 error("too few arguments to exec") end - ptrs = Array(Ptr{Uint8}, length(args)+1) + ptrs = Array(Ptr{UInt8}, length(args)+1) for i = 1:length(args) ptrs[i] = args[i].data end diff --git a/base/profile.jl b/base/profile.jl index cdb3804644f48..66eac14921986 100644 --- a/base/profile.jl +++ b/base/profile.jl @@ -23,7 +23,7 @@ end #### function init(; n::Union(Void,Integer) = nothing, delay::Union(Void,Float64) = nothing) n_cur = ccall(:jl_profile_maxlen_data, Csize_t, ()) - delay_cur = ccall(:jl_profile_delay_nsec, Uint64, ())/10^9 + delay_cur = ccall(:jl_profile_delay_nsec, UInt64, ())/10^9 if n == nothing && delay == nothing return int(n_cur), delay_cur end @@ -33,7 +33,7 @@ function init(; n::Union(Void,Integer) = nothing, delay::Union(Void,Float64) = n end function init(n::Integer, delay::Float64) - status = ccall(:jl_profile_init, Cint, (Csize_t, Uint64), n, iround(10^9*delay)) + status = ccall(:jl_profile_init, Cint, (Csize_t, UInt64), n, iround(10^9*delay)) if status == -1 error("could not allocate space for ", n, " instruction pointers") end @@ -61,12 +61,12 @@ function retrieve() copy(data), getdict(data) end -function getdict(data::Vector{Uint}) +function getdict(data::Vector{UInt}) uip = unique(data) - Dict{Uint, LineInfo}([ip=>lookup(ip) for ip in uip]) + Dict{UInt, LineInfo}([ip=>lookup(ip) for ip in uip]) end -function callers(funcname::ByteString, bt::Vector{Uint}, lidict; filename = nothing, linerange = nothing) +function callers(funcname::ByteString, bt::Vector{UInt}, lidict; filename = nothing, linerange = nothing) if filename == nothing && linerange == nothing return callersf(li -> li.func == funcname, bt, lidict) end @@ -79,7 +79,7 @@ function callers(funcname::ByteString, bt::Vector{Uint}, lidict; filename = noth end callers(funcname::ByteString; kwargs...) = callers(funcname, retrieve()...; kwargs...) -callers(func::Function, bt::Vector{Uint}, lidict; kwargs...) = callers(string(func), bt, lidict; kwargs...) +callers(func::Function, bt::Vector{UInt}, lidict; kwargs...) = callers(string(func), bt, lidict; kwargs...) callers(func::Function; kwargs...) = callers(string(func), retrieve()...; kwargs...) ## @@ -110,8 +110,8 @@ const UNKNOWN = LineInfo("?", "?", -1, true, 0) # ==(a::LineInfo, b::LineInfo) = a.line == b.line && a.fromC == b.fromC && a.func == b.func && a.file == b.file -function hash(li::LineInfo, h::Uint) - h += 0xf4fbda67fe20ce88 % Uint +function hash(li::LineInfo, h::UInt) + h += 0xf4fbda67fe20ce88 % UInt h = hash(li.line, h) h = hash(li.file, h) h = hash(li.func, h) @@ -124,13 +124,13 @@ stop_timer() = ccall(:jl_profile_stop_timer, Void, ()) is_running() = bool(ccall(:jl_profile_is_running, Cint, ())) -get_data_pointer() = convert(Ptr{Uint}, ccall(:jl_profile_get_data, Ptr{Uint8}, ())) +get_data_pointer() = convert(Ptr{UInt}, ccall(:jl_profile_get_data, Ptr{UInt8}, ())) len_data() = convert(Int, ccall(:jl_profile_len_data, Csize_t, ())) maxlen_data() = convert(Int, ccall(:jl_profile_maxlen_data, Csize_t, ())) -function lookup(ip::Uint) +function lookup(ip::UInt) info = ccall(:jl_lookup_code_address, Any, (Ptr{Void},Cint), ip, false) if length(info) == 5 return LineInfo(string(info[1]), string(info[2]), int(info[3]), info[4], int(info[5])) @@ -418,7 +418,7 @@ function tree{T<:Unsigned}(io::IO, data::Vector{T}, lidict::Dict, C::Bool, combi tree(io, bt[keep], counts[keep], lidict, level, combine, cols) end -function callersf(matchfunc::Function, bt::Vector{Uint}, lidict) +function callersf(matchfunc::Function, bt::Vector{UInt}, lidict) counts = Dict{LineInfo, Int}() lastmatched = false for id in bt diff --git a/base/random.jl b/base/random.jl index 6a2feb298897f..5bb3e5bdec33a 100644 --- a/base/random.jl +++ b/base/random.jl @@ -15,7 +15,7 @@ type MersenneTwister <: AbstractRNG state::DSFMT_state vals::Vector{Float64} idx::Int - seed::Vector{Uint32} + seed::Vector{UInt32} MersenneTwister(seed) = srand(new(DSFMT_state(), Array(Float64, dsfmt_get_min_array_size())), seed) @@ -40,10 +40,10 @@ end @inline rand_close_open(r::MersenneTwister) = (gen_rand_maybe(r); rand_inbounds(r)) # this is similar to `dsfmt_genrand_uint32` from dSFMT.h: -@inline rand_ui32(r::MersenneTwister) = reinterpret(Uint64, rand_close1_open2(r)) % Uint32 +@inline rand_ui32(r::MersenneTwister) = reinterpret(UInt64, rand_close1_open2(r)) % UInt32 -function srand(r::MersenneTwister, seed::Vector{Uint32}) +function srand(r::MersenneTwister, seed::Vector{UInt32}) r.seed = seed dsfmt_init_by_array(r.state, r.seed) r.idx = length(r.vals) @@ -58,13 +58,13 @@ function __init__() # Temporary fix for #8874 ccall((:dsfmt_gv_init_by_array,:libdSFMT), Void, - (Ptr{Uint32}, Int32), + (Ptr{UInt32}, Int32), 1+GLOBAL_RNG.seed, length(GLOBAL_RNG.seed)) end ## make_seed() -# make_seed methods produce values of type Array{Uint32}, suitable for MersenneTwister seeding +# make_seed methods produce values of type Array{UInt32}, suitable for MersenneTwister seeding function make_seed() @@ -73,17 +73,17 @@ function make_seed() return make_seed("/dev/urandom", 4) catch println(STDERR, "Entropy pool not available to seed RNG; using ad-hoc entropy sources.") - seed = reinterpret(Uint64, time()) + seed = reinterpret(UInt64, time()) seed = hash(seed, uint64(getpid())) try - seed = hash(seed, parseint(Uint64, readall(`ifconfig` |> `sha1sum`)[1:40], 16)) + seed = hash(seed, parseint(UInt64, readall(`ifconfig` |> `sha1sum`)[1:40], 16)) end return make_seed(seed) end end @windows_only begin - a = zeros(Uint32, 2) + a = zeros(UInt32, 2) win32_SystemFunction036!(a) return a end @@ -91,7 +91,7 @@ end function make_seed(n::Integer) n < 0 && throw(DomainError()) - seed = Uint32[] + seed = UInt32[] while true push!(seed, n & 0xffffffff) n >>= 32 @@ -103,7 +103,7 @@ end function make_seed(filename::AbstractString, n::Integer) open(filename) do io - a = Array(Uint32, int(n)) + a = Array(UInt32, int(n)) read!(io, a) a end @@ -116,7 +116,7 @@ srand(r::MersenneTwister, n::Integer) = srand(r, make_seed(n)) srand(r::MersenneTwister, filename::AbstractString, n::Integer=4) = srand(r, make_seed(filename, n)) srand() = srand(GLOBAL_RNG) -srand(seed::Union(Integer, Vector{Uint32})) = srand(GLOBAL_RNG, seed) +srand(seed::Union(Integer, Vector{UInt32})) = srand(GLOBAL_RNG, seed) srand(filename::AbstractString, n::Integer=4) = srand(GLOBAL_RNG, filename, n) ## Global RNG @@ -145,17 +145,17 @@ rand{T<:Union(Float16, Float32)}(r::MersenneTwister, ::Type{T}) = convert(T, ran ## random integers (MersenneTwister) -rand(r::MersenneTwister, ::Type{Uint8}) = rand(r, Uint32) % Uint8 -rand(r::MersenneTwister, ::Type{Uint16}) = rand(r, Uint32) % Uint16 -rand(r::MersenneTwister, ::Type{Uint32}) = rand_ui32(r) -rand(r::MersenneTwister, ::Type{Uint64}) = uint64(rand(r, Uint32)) <<32 | rand(r, Uint32) -rand(r::MersenneTwister, ::Type{Uint128}) = uint128(rand(r, Uint64))<<64 | rand(r, Uint64) +rand(r::MersenneTwister, ::Type{UInt8}) = rand(r, UInt32) % UInt8 +rand(r::MersenneTwister, ::Type{UInt16}) = rand(r, UInt32) % UInt16 +rand(r::MersenneTwister, ::Type{UInt32}) = rand_ui32(r) +rand(r::MersenneTwister, ::Type{UInt64}) = uint64(rand(r, UInt32)) <<32 | rand(r, UInt32) +rand(r::MersenneTwister, ::Type{UInt128}) = uint128(rand(r, UInt64))<<64 | rand(r, UInt64) -rand(r::MersenneTwister, ::Type{Int8}) = rand(r, Uint32) % Int8 -rand(r::MersenneTwister, ::Type{Int16}) = rand(r, Uint32) % Int16 -rand(r::MersenneTwister, ::Type{Int32}) = reinterpret(Int32, rand(r, Uint32)) -rand(r::MersenneTwister, ::Type{Int64}) = reinterpret(Int64, rand(r, Uint64)) -rand(r::MersenneTwister, ::Type{Int128}) = reinterpret(Int128, rand(r, Uint128)) +rand(r::MersenneTwister, ::Type{Int8}) = rand(r, UInt32) % Int8 +rand(r::MersenneTwister, ::Type{Int16}) = rand(r, UInt32) % Int16 +rand(r::MersenneTwister, ::Type{Int32}) = reinterpret(Int32, rand(r, UInt32)) +rand(r::MersenneTwister, ::Type{Int64}) = reinterpret(Int64, rand(r, UInt64)) +rand(r::MersenneTwister, ::Type{Int128}) = reinterpret(Int128, rand(r, UInt128)) ## random complex values @@ -219,17 +219,17 @@ end ## Generate random integer within a range # remainder function according to Knuth, where rem_knuth(a, 0) = a -rem_knuth(a::Uint, b::Uint) = a % (b + (b == 0)) + a * (b == 0) +rem_knuth(a::UInt, b::UInt) = a % (b + (b == 0)) + a * (b == 0) rem_knuth{T<:Unsigned}(a::T, b::T) = b != 0 ? a % b : a # maximum multiple of k <= 2^bits(T) decremented by one, # that is 0xFFFFFFFF if k = typemax(T) - typemin(T) with intentional underflow -maxmultiple(k::Uint32) = (div(0x0000000100000000,k + (k == 0))*k - 1) % Uint32 -maxmultiple(k::Uint64) = (div(0x00000000000000010000000000000000, k + (k == 0))*k - 1) % Uint64 -# maximum multiple of k within 1:typemax(Uint128) -maxmultiple(k::Uint128) = div(typemax(Uint128), k + (k == 0))*k - 1 +maxmultiple(k::UInt32) = (div(0x0000000100000000,k + (k == 0))*k - 1) % UInt32 +maxmultiple(k::UInt64) = (div(0x00000000000000010000000000000000, k + (k == 0))*k - 1) % UInt64 +# maximum multiple of k within 1:typemax(UInt128) +maxmultiple(k::UInt128) = div(typemax(UInt128), k + (k == 0))*k - 1 # maximum multiple of k within 1:2^32 or 1:2^64, depending on size -maxmultiplemix(k::Uint64) = (div((k >> 32 != 0)*0x0000000000000000FFFFFFFF00000000 + 0x0000000100000000, k + (k == 0))*k - 1) % Uint64 +maxmultiplemix(k::UInt64) = (div((k >> 32 != 0)*0x0000000000000000FFFFFFFF00000000 + 0x0000000100000000, k + (k == 0))*k - 1) % UInt64 immutable RandIntGen{T<:Integer, U<:Unsigned} a::T # first element of the range @@ -237,38 +237,38 @@ immutable RandIntGen{T<:Integer, U<:Unsigned} u::U # rejection threshold end # generators with 32, 128 bits entropy -RandIntGen{T, U<:Union(Uint32, Uint128)}(a::T, k::U) = RandIntGen{T, U}(a, k, maxmultiple(k)) +RandIntGen{T, U<:Union(UInt32, UInt128)}(a::T, k::U) = RandIntGen{T, U}(a, k, maxmultiple(k)) # mixed 32/64 bits entropy generator -RandIntGen{T}(a::T, k::Uint64) = RandIntGen{T,Uint64}(a, k, maxmultiplemix(k)) +RandIntGen{T}(a::T, k::UInt64) = RandIntGen{T,UInt64}(a, k, maxmultiplemix(k)) # generator for ranges RandIntGen{T<:Unsigned}(r::UnitRange{T}) = isempty(r) ? error("range must be non-empty") : RandIntGen(first(r), last(r) - first(r) + one(T)) # specialized versions -for (T, U) in [(Uint8, Uint32), (Uint16, Uint32), - (Int8, Uint32), (Int16, Uint32), (Int32, Uint32), (Int64, Uint64), (Int128, Uint128), - (Bool, Uint32)] +for (T, U) in [(UInt8, UInt32), (UInt16, UInt32), + (Int8, UInt32), (Int16, UInt32), (Int32, UInt32), (Int64, UInt64), (Int128, UInt128), + (Bool, UInt32)] @eval RandIntGen(r::UnitRange{$T}) = isempty(r) ? error("range must be non-empty") : RandIntGen(first(r), convert($U, unsigned(last(r) - first(r)) + one($U))) # overflow ok end -# this function uses 32 bit entropy for small ranges of length <= typemax(Uint32) + 1 +# this function uses 32 bit entropy for small ranges of length <= typemax(UInt32) + 1 # RandIntGen is responsible for providing the right value of k -function rand{T<:Union(Uint64, Int64)}(g::RandIntGen{T,Uint64}) - local x::Uint64 +function rand{T<:Union(UInt64, Int64)}(g::RandIntGen{T,UInt64}) + local x::UInt64 if (g.k - 1) >> 32 == 0 - x = rand(Uint32) + x = rand(UInt32) while x > g.u - x = rand(Uint32) + x = rand(UInt32) end else - x = rand(Uint64) + x = rand(UInt64) while x > g.u - x = rand(Uint64) + x = rand(UInt64) end end - return reinterpret(T, reinterpret(Uint64, g.a) + rem_knuth(x, g.k)) + return reinterpret(T, reinterpret(UInt64, g.a) + rem_knuth(x, g.k)) end function rand{T<:Integer, U<:Unsigned}(g::RandIntGen{T,U}) @@ -312,7 +312,7 @@ randbool(r::AbstractRNG, dims::Int...) = rand!(r, BitArray(dims)) randbool(dims::Dims) = rand!(BitArray(dims)) randbool(dims::Int...) = rand!(BitArray(dims)) -randbool(r::MersenneTwister=GLOBAL_RNG) = ((rand(r, Uint32) & 1) == 1) +randbool(r::MersenneTwister=GLOBAL_RNG) = ((rand(r, UInt32) & 1) == 1) rand(r::MersenneTwister, ::Type{Bool}) = randbool(r) @@ -325,7 +325,7 @@ rand(r::MersenneTwister, ::Type{Bool}) = randbool(r) # randmtzig (covers also exponential variates) ## Tables for normal variates const ki = - Uint64[0x0007799ec012f7b3, 0,0x0006045f4c7de363,0x0006d1aa7d5ec0a6, + UInt64[0x0007799ec012f7b3, 0,0x0006045f4c7de363,0x0006d1aa7d5ec0a6, 0x000728fb3f60f778,0x0007592af4e9fbc0,0x000777a5c0bf655d,0x00078ca3857d2256, 0x00079bf6b0ffe58c,0x0007a7a34ab092ae,0x0007b0d2f20dd1cb,0x0007b83d3aa9cb52, 0x0007be597614224e,0x0007c3788631abea,0x0007c7d32bc192ef,0x0007cb9263a6e86d, @@ -566,7 +566,7 @@ const fi = ## Tables for exponential variates const ke = -Uint64[0x000e290a13924be4,0 ,0x0009beadebce18c0,0x000c377ac71f9e08, +UInt64[0x000e290a13924be4,0 ,0x0009beadebce18c0,0x000c377ac71f9e08, 0x000d4ddb99075857,0x000de893fb8ca23e,0x000e4a8e87c4328e,0x000e8dff16ae1cba, 0x000ebf2deab58c5a,0x000ee49a6e8b9639,0x000f0204efd64ee5,0x000f19bdb8ea3c1c, 0x000f2d458bbe5bd2,0x000f3da104b78236,0x000f4b86d784571f,0x000f577ad8a7784f, @@ -810,7 +810,7 @@ ziggurat_nor_r = 3.6541528853610087963519472518 ziggurat_nor_inv_r = inv(ziggurat_nor_r) ziggurat_exp_r = 7.6971174701310497140446280481 -@inline randi(rng::MersenneTwister=GLOBAL_RNG) = reinterpret(Uint64, rand_close1_open2(rng)) & 0x000fffffffffffff +@inline randi(rng::MersenneTwister=GLOBAL_RNG) = reinterpret(UInt64, rand_close1_open2(rng)) & 0x000fffffffffffff for (lhs, rhs) in (([], []), ([:(rng::MersenneTwister)], [:rng])) @eval begin @@ -869,12 +869,12 @@ randn(rng::MersenneTwister, dims::Int...) = randn!(rng, Array(Float64, dims...)) ## random UUID generation immutable UUID - value::Uint128 + value::UInt128 end UUID(u::AbstractString) = convert(UUID, u) function uuid4() - u = rand(Uint128) + u = rand(UInt128) u &= 0xffffffffffff0fff3fffffffffffffff u |= 0x00000000000040008000000000000000 UUID(u) @@ -898,7 +898,7 @@ end function Base.repr(u::UUID) u = u.value - a = Array(Uint8,36) + a = Array(UInt8,36) for i = [36:-1:25; 23:-1:20; 18:-1:15; 13:-1:10; 8:-1:1] d = u & 0xf a[i] = '0'+d+39*(d>9) diff --git a/base/range.jl b/base/range.jl index 08c48926a4ebe..1cf7f5f4d431a 100644 --- a/base/range.jl +++ b/base/range.jl @@ -185,7 +185,7 @@ end length(r::UnitRange) = integer(r.stop - r.start + 1) length(r::FloatRange) = integer(r.len) -function length{T<:Union(Int,Uint,Int64,Uint64)}(r::StepRange{T}) +function length{T<:Union(Int,UInt,Int64,UInt64)}(r::StepRange{T}) isempty(r) && return zero(T) if r.step > 1 return checked_add(convert(T, div(unsigned(r.stop - r.start), r.step)), one(T)) @@ -196,13 +196,13 @@ function length{T<:Union(Int,Uint,Int64,Uint64)}(r::StepRange{T}) end end -length{T<:Union(Int,Uint,Int64,Uint64)}(r::UnitRange{T}) = +length{T<:Union(Int,UInt,Int64,UInt64)}(r::UnitRange{T}) = checked_add(checked_sub(r.stop, r.start), one(T)) # some special cases to favor default Int type let smallint = (Int === Int64 ? - Union(Int8,Uint8,Int16,Uint16,Int32,Uint32) : - Union(Int8,Uint8,Int16,Uint16)) + Union(Int8,UInt8,Int16,UInt16,Int32,UInt32) : + Union(Int8,UInt8,Int16,UInt16)) global length function length{T <: smallint}(r::StepRange{T}) diff --git a/base/reduce.jl b/base/reduce.jl index 63b688c2af3eb..43d268b1fb722 100644 --- a/base/reduce.jl +++ b/base/reduce.jl @@ -45,13 +45,13 @@ call(::MinFun, x, y) = scalarmin(x, y) if Int === Int32 typealias SmallSigned Union(Int8,Int16) -typealias SmallUnsigned Union(Uint8,Uint16) +typealias SmallUnsigned Union(UInt8,UInt16) else typealias SmallSigned Union(Int8,Int16,Int32) -typealias SmallUnsigned Union(Uint8,Uint16,Uint32) +typealias SmallUnsigned Union(UInt8,UInt16,UInt32) end -typealias CommonReduceResult Union(Uint64,Uint128,Int64,Int128,Float32,Float64) +typealias CommonReduceResult Union(UInt64,UInt128,Int64,Int128,Float32,Float64) typealias WidenReduceResult Union(SmallSigned, SmallUnsigned, Float16) # r_promote: promote x to the type of reduce(op, [x]) diff --git a/base/reducedim.jl b/base/reducedim.jl index eb7f3470d1148..b15721007113e 100644 --- a/base/reducedim.jl +++ b/base/reducedim.jl @@ -101,7 +101,7 @@ reducedim_init(f, op::OrFun, A::AbstractArray, region) = reducedim_initarray(A, # specialize to make initialization more efficient for common cases -for (IT, RT) in ((CommonReduceResult, :(eltype(A))), (SmallSigned, :Int), (SmallUnsigned, :Uint)) +for (IT, RT) in ((CommonReduceResult, :(eltype(A))), (SmallSigned, :Int), (SmallUnsigned, :UInt)) T = Union([AbstractArray{t} for t in IT.types]..., [AbstractArray{Complex{t}} for t in IT.types]...) @eval begin reducedim_init(f::IdFun, op::AddFun, A::$T, region) = diff --git a/base/reflection.jl b/base/reflection.jl index 15daa716b9b6a..ecbd86655fe43 100644 --- a/base/reflection.jl +++ b/base/reflection.jl @@ -45,7 +45,7 @@ isconst(m::Module, s::Symbol) = ccall(:jl_is_const, Int32, (Any, Any), m, s) != 0 # return an integer such that object_id(x)==object_id(y) if is(x,y) -object_id(x::ANY) = ccall(:jl_object_id, Uint, (Any,), x) +object_id(x::ANY) = ccall(:jl_object_id, UInt, (Any,), x) # type predicates isimmutable(x::ANY) = (isa(x,Tuple) || !typeof(x).mutable) diff --git a/base/regex.jl b/base/regex.jl index c071570693434..14c74e6c6e111 100644 --- a/base/regex.jl +++ b/base/regex.jl @@ -6,7 +6,7 @@ const DEFAULT_OPTS = PCRE.JAVASCRIPT_COMPAT | PCRE.UTF8 | PCRE.NO_UTF8_CHECK type Regex pattern::ByteString - options::Uint32 + options::UInt32 regex::Ptr{Void} extra::Ptr{Void} ovec::Vector{Int32} @@ -113,7 +113,7 @@ function ismatch(r::Regex, s::SubString, offset::Integer=0) r.ovec) end -function match(re::Regex, str::UTF8String, idx::Integer, add_opts::Uint32=uint32(0)) +function match(re::Regex, str::UTF8String, idx::Integer, add_opts::UInt32=uint32(0)) opts = re.options & PCRE.EXECUTE_MASK | add_opts compile(re) if !PCRE.exec(re.regex, re.extra, str, idx-1, opts, re.ovec) @@ -127,7 +127,7 @@ function match(re::Regex, str::UTF8String, idx::Integer, add_opts::Uint32=uint32 RegexMatch(mat, cap, re.ovec[1]+1, off) end -match(re::Regex, str::Union(ByteString,SubString), idx::Integer, add_opts::Uint32=uint32(0)) = +match(re::Regex, str::Union(ByteString,SubString), idx::Integer, add_opts::UInt32=uint32(0)) = match(re, utf8(str), idx, add_opts) match(r::Regex, s::AbstractString) = match(r, s, start(s)) @@ -146,7 +146,7 @@ function matchall(re::Regex, str::UTF8String, overlap::Bool=false) ovec = Array(Int32, 3) while true result = ccall((:pcre_exec, :libpcre), Int32, - (Ptr{Void}, Ptr{Void}, Ptr{Uint8}, Int32, + (Ptr{Void}, Ptr{Void}, Ptr{UInt8}, Int32, Int32, Int32, Ptr{Int32}, Int32), regex, extra, str, n, offset, prevempty ? opts_nonempty : opts, ovec, 3) diff --git a/base/serialize.jl b/base/serialize.jl index af1b2fa0fe2b6..aa9f2e8b57cdb 100644 --- a/base/serialize.jl +++ b/base/serialize.jl @@ -12,8 +12,8 @@ const deser_tag = ObjectIdDict() let i = 2 global ser_tag, deser_tag for t = Any[ - Symbol, Int8, Uint8, Int16, Uint16, Int32, Uint32, - Int64, Uint64, Int128, Uint128, Float32, Float64, Char, Ptr, + Symbol, Int8, UInt8, Int16, UInt16, Int32, UInt32, + Int64, UInt64, Int128, UInt128, Float32, Float64, Char, Ptr, DataType, UnionType, Function, Tuple, Array, Expr, LongSymbol, LongTuple, LongExpr, LineNumberNode, SymbolNode, LabelNode, GotoNode, @@ -84,8 +84,8 @@ function serialize(s, x::Symbol) if haskey(ser_tag, x) return write_as_tag(s, x) end - pname = convert(Ptr{Uint8}, x) - ln = int(ccall(:strlen, Csize_t, (Ptr{Uint8},), pname)) + pname = convert(Ptr{UInt8}, x) + ln = int(ccall(:strlen, Csize_t, (Ptr{UInt8},), pname)) if ln <= 255 writetag(s, Symbol) write(s, uint8(ln)) @@ -119,7 +119,7 @@ end function serialize(s, a::Array) writetag(s, Array) elty = eltype(a) - if elty !== Uint8 + if elty !== UInt8 serialize(s, elty) end if ndims(a) != 1 @@ -332,18 +332,18 @@ end ## deserializing values ## function deserialize(s) - handle_deserialize(s, int32(read(s, Uint8))) + handle_deserialize(s, int32(read(s, UInt8))) end function handle_deserialize(s, b) if b == 0 - return deser_tag[int32(read(s, Uint8))] + return deser_tag[int32(read(s, UInt8))] end tag = deser_tag[b] if b >= VALUE_TAGS return tag elseif is(tag,Tuple) - len = int32(read(s, Uint8)) + len = int32(read(s, UInt8)) return deserialize_tuple(s, len) elseif is(tag,LongTuple) len = read(s, Int32) @@ -354,8 +354,8 @@ end deserialize_tuple(s, len) = ntuple(len, i->deserialize(s)) -deserialize(s, ::Type{Symbol}) = symbol(read(s, Uint8, int32(read(s, Uint8)))) -deserialize(s, ::Type{LongSymbol}) = symbol(read(s, Uint8, read(s, Int32))) +deserialize(s, ::Type{Symbol}) = symbol(read(s, UInt8, int32(read(s, UInt8)))) +deserialize(s, ::Type{LongSymbol}) = symbol(read(s, UInt8, read(s, Int32))) function deserialize(s, ::Type{Module}) path = deserialize(s) @@ -384,7 +384,7 @@ end const known_lambda_data = Dict() function deserialize(s, ::Type{Function}) - b = read(s, Uint8) + b = read(s, UInt8) if b==0 name = deserialize(s)::Symbol if !isdefined(Base,name) @@ -437,7 +437,7 @@ function deserialize(s, ::Type{Array}) elty = d1 d1 = deserialize(s) else - elty = Uint8 + elty = UInt8 end if isa(d1,Integer) if elty !== Bool && isbits(elty) @@ -453,7 +453,7 @@ function deserialize(s, ::Type{Array}) A = Array(Bool, dims) i = 1 while i <= n - b = read(s, Uint8) + b = read(s, UInt8) v = bool(b>>7) count = b&0x7f nxt = i+count @@ -468,7 +468,7 @@ function deserialize(s, ::Type{Array}) end A = Array(elty, dims) for i = 1:length(A) - tag = int32(read(s, Uint8)) + tag = int32(read(s, UInt8)) if tag==0 || !is(deser_tag[tag], UndefRefTag) A[i] = handle_deserialize(s, tag) end @@ -476,7 +476,7 @@ function deserialize(s, ::Type{Array}) return A end -deserialize(s, ::Type{Expr}) = deserialize_expr(s, int32(read(s, Uint8))) +deserialize(s, ::Type{Expr}) = deserialize_expr(s, int32(read(s, UInt8))) deserialize(s, ::Type{LongExpr}) = deserialize_expr(s, read(s, Int32)) function deserialize_expr(s, len) @@ -494,7 +494,7 @@ function deserialize(s, ::Type{UnionType}) end function deserialize(s, ::Type{DataType}) - form = read(s, Uint8) + form = read(s, UInt8) name = deserialize(s)::Symbol mod = deserialize(s)::Module ty = eval(mod,name) @@ -548,13 +548,13 @@ function deserialize(s, t::DataType) return ccall(:jl_new_struct, Any, (Any,Any...), t, f1, f2, f3) else flds = Any[ deserialize(s) for i = 1:nf ] - return ccall(:jl_new_structv, Any, (Any,Ptr{Void},Uint32), + return ccall(:jl_new_structv, Any, (Any,Ptr{Void},UInt32), t, flds, nf) end else x = ccall(:jl_new_struct_uninit, Any, (Any,), t) for i in 1:length(t.names) - tag = int32(read(s, Uint8)) + tag = int32(read(s, UInt8)) if tag==0 || !is(deser_tag[tag], UndefRefTag) setfield!(x, i, handle_deserialize(s, tag)) end diff --git a/base/sharedarray.jl b/base/sharedarray.jl index b468329765667..1a0b12a6efbc1 100644 --- a/base/sharedarray.jl +++ b/base/sharedarray.jl @@ -368,12 +368,12 @@ end @unix_only begin function shm_unlink(shm_seg_name) - rc = ccall(:shm_unlink, Cint, (Ptr{Uint8},), shm_seg_name) + rc = ccall(:shm_unlink, Cint, (Ptr{UInt8},), shm_seg_name) systemerror("Error unlinking shmem segment " * shm_seg_name, rc != 0) rc end end -@unix_only shm_open(shm_seg_name, oflags, permissions) = ccall(:shm_open, Int, (Ptr{Uint8}, Int, Int), shm_seg_name, oflags, permissions) +@unix_only shm_open(shm_seg_name, oflags, permissions) = ccall(:shm_open, Int, (Ptr{UInt8}, Int, Int), shm_seg_name, oflags, permissions) diff --git a/base/show.jl b/base/show.jl index 905a7c38874a2..f923ec6f4486d 100644 --- a/base/show.jl +++ b/base/show.jl @@ -46,7 +46,7 @@ function show(io::IO, x::ANY) print(io, "0x") p = pointer_from_objref(x) + sizeof(Ptr{Void}) for i=nb-1:-1:0 - print(io, hex(unsafe_load(convert(Ptr{Uint8}, p+i)), 2)) + print(io, hex(unsafe_load(convert(Ptr{UInt8}, p+i)), 2)) end end print(io,')') @@ -246,8 +246,8 @@ const expr_parens = Dict(:tuple=>('(',')'), :vcat=>('[',']'), :cell1d=>("Any["," ## AST decoding helpers ## -is_id_start_char(c::Char) = ccall(:jl_id_start_char, Cint, (Uint32,), c) != 0 -is_id_char(c::Char) = ccall(:jl_id_char, Cint, (Uint32,), c) != 0 +is_id_start_char(c::Char) = ccall(:jl_id_start_char, Cint, (UInt32,), c) != 0 +is_id_char(c::Char) = ccall(:jl_id_char, Cint, (UInt32,), c) != 0 function isidentifier(s::AbstractString) i = start(s) done(s, i) && return false @@ -260,9 +260,9 @@ function isidentifier(s::AbstractString) return true end -isoperator(s::Symbol) = ccall(:jl_is_operator, Cint, (Ptr{Uint8},), s) != 0 +isoperator(s::Symbol) = ccall(:jl_is_operator, Cint, (Ptr{UInt8},), s) != 0 operator_precedence(s::Symbol) = int(ccall(:jl_operator_precedence, - Cint, (Ptr{Uint8},), s)) + Cint, (Ptr{UInt8},), s)) operator_precedence(x::Any) = 0 # fallback for generic expression nodes const prec_power = operator_precedence(:(^)) @@ -1193,7 +1193,7 @@ show(io::IO, v::AbstractVector) = show_vector(io, v, "[", "]") # (following functions not exported - mainly intended for debug) -function print_bit_chunk(io::IO, c::Uint64, l::Integer) +function print_bit_chunk(io::IO, c::UInt64, l::Integer) for s = 0 : l - 1 d = (c >>> s) & 1 print(io, "01"[d + 1]) @@ -1203,10 +1203,10 @@ function print_bit_chunk(io::IO, c::Uint64, l::Integer) end end -print_bit_chunk(io::IO, c::Uint64) = print_bit_chunk(io, c, 64) +print_bit_chunk(io::IO, c::UInt64) = print_bit_chunk(io, c, 64) -print_bit_chunk(c::Uint64, l::Integer) = print_bit_chunk(STDOUT, c, l) -print_bit_chunk(c::Uint64) = print_bit_chunk(STDOUT, c) +print_bit_chunk(c::UInt64, l::Integer) = print_bit_chunk(STDOUT, c, l) +print_bit_chunk(c::UInt64) = print_bit_chunk(STDOUT, c) function bitshow(io::IO, B::BitArray) if length(B) == 0 diff --git a/base/socket.jl b/base/socket.jl index b7b2da554d79e..67139fc35fdaf 100644 --- a/base/socket.jl +++ b/base/socket.jl @@ -2,9 +2,9 @@ abstract IPAddr immutable IPv4 <: IPAddr - host::Uint32 - IPv4(host::Uint32) = new(host) - IPv4(a::Uint8,b::Uint8,c::Uint8,d::Uint8) = new(uint32(a)<<24| + host::UInt32 + IPv4(host::UInt32) = new(host) + IPv4(a::UInt8,b::UInt8,c::UInt8,d::UInt8) = new(uint32(a)<<24| uint32(b)<<16| uint32(c)<<8| d) @@ -19,7 +19,7 @@ end function IPv4(host::Integer) if host < 0 error("IP address must not be negative") - elseif typemax(typeof(host)) > typemax(Uint32) && host > typemax(Uint32) + elseif typemax(typeof(host)) > typemax(UInt32) && host > typemax(UInt32) error("IPv4 address must fit within 32 bits") else return IPv4(uint32(host)) @@ -33,10 +33,10 @@ print(io::IO,ip::IPv4) = print(io,dec((ip.host&(0xFF000000))>>24),".", dec(ip.host&0xFF)) immutable IPv6 <: IPAddr - host::Uint128 - IPv6(host::Uint128) = new(host) - IPv6(a::Uint16,b::Uint16,c::Uint16,d::Uint16, - e::Uint16,f::Uint16,g::Uint16,h::Uint16) = new(uint128(a)<<(7*16)| + host::UInt128 + IPv6(host::UInt128) = new(host) + IPv6(a::UInt16,b::UInt16,c::UInt16,d::UInt16, + e::UInt16,f::UInt16,g::UInt16,h::UInt16) = new(uint128(a)<<(7*16)| uint128(b)<<(6*16)| uint128(c)<<(5*16)| uint128(d)<<(4*16)| @@ -60,7 +60,7 @@ function IPv6(host::Integer) error("IP address must not be negative") # We allow passing bigger integer types, but need to be careful to avoid overflow # Let's hope promotion rules are sensible - elseif typemax(typeof(host)) > typemax(Uint128) && host > typemax(Uint128) + elseif typemax(typeof(host)) > typemax(UInt128) && host > typemax(UInt128) error("IPv6 address must fit within 128 bits") else return IPv6(uint128(host)) @@ -68,7 +68,7 @@ function IPv6(host::Integer) end # Suppress leading '0's and "0x" -print_ipv6_field(io,field::Uint16) = print(io,hex(field)) +print_ipv6_field(io,field::UInt16) = print(io,hex(field)) print_ipv6_field(io,ip,i) = print_ipv6_field(io,ipv6_field(ip,i)) function ipv6_field(ip::IPv6,i) @@ -225,9 +225,9 @@ end type InetAddr host::IPAddr - port::Uint16 + port::UInt16 function InetAddr(host,port) - if !(0 <= port <= typemax(Uint16)) + if !(0 <= port <= typemax(UInt16)) throw(DomainError()) end new(host,uint16(port)) @@ -326,8 +326,8 @@ _jl_connect_raw(sock::TCPSocket,sockaddr::Ptr{Void}) = ccall(:jl_connect_raw,Int32,(Ptr{Void},Ptr{Void}),sock.handle,sockaddr) _jl_sockaddr_from_addrinfo(addrinfo::Ptr{Void}) = ccall(:jl_sockaddr_from_addrinfo,Ptr{Void},(Ptr{Void},),addrinfo) -_jl_sockaddr_set_port(ptr::Ptr{Void},port::Uint16) = - ccall(:jl_sockaddr_set_port,Void,(Ptr{Void},Uint16),ptr,port) +_jl_sockaddr_set_port(ptr::Ptr{Void},port::UInt16) = + ccall(:jl_sockaddr_set_port,Void,(Ptr{Void},UInt16),ptr,port) accept(server::TCPServer) = accept(server, TCPSocket()) accept(server::PipeServer) = accept(server, Pipe()) @@ -336,10 +336,10 @@ accept(server::PipeServer) = accept(server, Pipe()) bind(sock::TCPServer, addr::InetAddr) = bind(sock,addr.host,addr.port) -_bind(sock::TCPServer, host::IPv4, port::Uint16) = ccall(:jl_tcp_bind, Int32, (Ptr{Void}, Uint16, Uint32, Cuint), +_bind(sock::TCPServer, host::IPv4, port::UInt16) = ccall(:jl_tcp_bind, Int32, (Ptr{Void}, UInt16, UInt32, Cuint), sock.handle, hton(port), hton(host.host), 0) -_bind(sock::TCPServer, host::IPv6, port::Uint16) = ccall(:jl_tcp_bind6, Int32, (Ptr{Void}, Uint16, Ptr{Uint128}, Cuint), +_bind(sock::TCPServer, host::IPv6, port::UInt16) = ccall(:jl_tcp_bind6, Int32, (Ptr{Void}, UInt16, Ptr{UInt128}, Cuint), sock.handle, hton(port), &hton(host.host), 0) # UDP @@ -411,13 +411,13 @@ function bind(sock::Union(TCPServer,UDPSocket), host::IPv4, port::Integer) true end -_bind(sock::UDPSocket, host::IPv4, port::Uint16) = ccall(:jl_udp_bind, Int32, (Ptr{Void}, Uint16, Uint32, Uint32), +_bind(sock::UDPSocket, host::IPv4, port::UInt16) = ccall(:jl_udp_bind, Int32, (Ptr{Void}, UInt16, UInt32, UInt32), sock.handle, hton(port), hton(host.host), 0) -_bind(sock::UDPSocket, host::IPv6, port::Uint16, flags::Uint32 = uint32(0)) = ccall(:jl_udp_bind6, Int32, (Ptr{Void}, Uint16, Ptr{Uint128}, Uint32), +_bind(sock::UDPSocket, host::IPv6, port::UInt16, flags::UInt32 = uint32(0)) = ccall(:jl_udp_bind6, Int32, (Ptr{Void}, UInt16, Ptr{UInt128}, UInt32), sock.handle, hton(port), &hton(host.host), flags) -function bind(sock::UDPSocket, host::IPv6, port::Uint16; ipv6only = false) +function bind(sock::UDPSocket, host::IPv6, port::UInt16; ipv6only = false) @assert sock.status == StatusInit err = _bind(sock,host,ipv6only ? UV_UDP_IPV6ONLY : 0) if err < 0 @@ -450,7 +450,7 @@ function setopt(sock::UDPSocket; multicast_loop = nothing, multicast_ttl=nothing end end -_uv_hook_alloc_buf(sock::UDPSocket,size::Uint) = (c_malloc(size),size) +_uv_hook_alloc_buf(sock::UDPSocket,size::UInt) = (c_malloc(size),size) function _recv_start(sock::UDPSocket) if ccall(:uv_is_active,Cint,(Ptr{Void},),sock.handle) == 0 @@ -467,25 +467,25 @@ function recv(sock::UDPSocket) error("Invalid socket state") end _recv_start(sock) - stream_wait(sock,sock.recvnotify)::Vector{Uint8} + stream_wait(sock,sock.recvnotify)::Vector{UInt8} end -function _uv_hook_recv(sock::UDPSocket, nread::Int, buf_addr::Ptr{Void}, buf_size::Uint, addr::Ptr{Void}, flags::Int32) +function _uv_hook_recv(sock::UDPSocket, nread::Int, buf_addr::Ptr{Void}, buf_size::UInt, addr::Ptr{Void}, flags::Int32) if flags & UV_UDP_PARTIAL > 0 # TODO: Decide what to do in this case. For now throw an error c_free(buf_addr) notify_error(sock.recvnotify,"Partial message received") end - buf = pointer_to_array(convert(Ptr{Uint8},buf_addr),int(buf_size),true) + buf = pointer_to_array(convert(Ptr{UInt8},buf_addr),int(buf_size),true) notify(sock.recvnotify,buf[1:nread]) end -function _send(sock::UDPSocket,ipaddr::IPv4,port::Uint16,buf) - ccall(:jl_udp_send,Cint,(Ptr{Void},Uint16,Uint32,Ptr{Uint8},Csize_t),sock.handle,hton(port),hton(ipaddr.host),buf,sizeof(buf)) +function _send(sock::UDPSocket,ipaddr::IPv4,port::UInt16,buf) + ccall(:jl_udp_send,Cint,(Ptr{Void},UInt16,UInt32,Ptr{UInt8},Csize_t),sock.handle,hton(port),hton(ipaddr.host),buf,sizeof(buf)) end -function _send(sock::UDPSocket,ipaddr::IPv6,port::Uint16,buf) - ccall(:jl_udp_send6,Cint,(Ptr{Void},Uint16,Ptr{Uint128},Ptr{Uint8},Csize_t),sock.handle,hton(port),&hton(ipaddr.host),buf,sizeof(buf)) +function _send(sock::UDPSocket,ipaddr::IPv6,port::UInt16,buf) + ccall(:jl_udp_send6,Cint,(Ptr{Void},UInt16,Ptr{UInt128},Ptr{UInt8},Csize_t),sock.handle,hton(port),&hton(ipaddr.host),buf,sizeof(buf)) end function send(sock::UDPSocket,ipaddr,port,msg) @@ -519,11 +519,11 @@ function _uv_hook_getaddrinfo(cb::Function, addrinfo::Ptr{Void}, status::Int32) while addrinfo != C_NULL sockaddr = ccall(:jl_sockaddr_from_addrinfo,Ptr{Void},(Ptr{Void},),addrinfo) if ccall(:jl_sockaddr_is_ip4,Int32,(Ptr{Void},),sockaddr) == 1 - cb(IPv4(ntoh(ccall(:jl_sockaddr_host4,Uint32,(Ptr{Void},),sockaddr)))) + cb(IPv4(ntoh(ccall(:jl_sockaddr_host4,UInt32,(Ptr{Void},),sockaddr)))) break #elseif ccall(:jl_sockaddr_is_ip6,Int32,(Ptr{Void},),sockaddr) == 1 - # host = Array(Uint128,1) - # scope_id = ccall(:jl_sockaddr_host6,Uint32,(Ptr{Void},Ptr{Uint128}),sockaddr,host) + # host = Array(UInt128,1) + # scope_id = ccall(:jl_sockaddr_host6,UInt32,(Ptr{Void},Ptr{UInt128}),sockaddr,host) # cb(IPv6(ntoh(host[1]))) # break end @@ -534,7 +534,7 @@ end function getaddrinfo(cb::Function, host::ASCIIString) callback_dict[cb] = cb - uv_error("getaddrinfo",ccall(:jl_getaddrinfo, Int32, (Ptr{Void}, Ptr{Uint8}, Ptr{Uint8}, Any), + uv_error("getaddrinfo",ccall(:jl_getaddrinfo, Int32, (Ptr{Void}, Ptr{UInt8}, Ptr{UInt8}, Any), eventloop(), host, C_NULL, cb)) end getaddrinfo(cb::Function, host::AbstractString) = getaddrinfo(cb,ascii(host)) @@ -553,32 +553,32 @@ getaddrinfo(host::AbstractString) = getaddrinfo(ascii(host)) const _sizeof_uv_interface_address = ccall(:jl_uv_sizeof_interface_address,Int32,()) function getipaddr() - addr = Array(Ptr{Uint8},1) + addr = Array(Ptr{UInt8},1) count = Array(Int32,1) lo_present = false - err = ccall(:jl_uv_interface_addresses,Int32,(Ptr{Ptr{Uint8}},Ptr{Int32}),addr,count) + err = ccall(:jl_uv_interface_addresses,Int32,(Ptr{Ptr{UInt8}},Ptr{Int32}),addr,count) addr, count = addr[1],count[1] if err != 0 - ccall(:uv_free_interface_addresses,Void,(Ptr{Uint8},Int32),addr,count) + ccall(:uv_free_interface_addresses,Void,(Ptr{UInt8},Int32),addr,count) throw(UVError("getlocalip",err)) end for i = 0:(count-1) current_addr = addr + i*_sizeof_uv_interface_address - if 1 == ccall(:jl_uv_interface_address_is_internal,Int32,(Ptr{Uint8},),current_addr) + if 1 == ccall(:jl_uv_interface_address_is_internal,Int32,(Ptr{UInt8},),current_addr) lo_present = true continue end - sockaddr = ccall(:jl_uv_interface_address_sockaddr,Ptr{Void},(Ptr{Uint8},),current_addr) + sockaddr = ccall(:jl_uv_interface_address_sockaddr,Ptr{Void},(Ptr{UInt8},),current_addr) if ccall(:jl_sockaddr_in_is_ip4,Int32,(Ptr{Void},),sockaddr) == 1 - return IPv4(ntoh(ccall(:jl_sockaddr_host4,Uint32,(Ptr{Void},),sockaddr))) + return IPv4(ntoh(ccall(:jl_sockaddr_host4,UInt32,(Ptr{Void},),sockaddr))) # Uncomment to enbable IPv6 #elseif ccall(:jl_sockaddr_in_is_ip6,Int32,(Ptr{Void},),sockaddr) == 1 - # host = Array(Uint128,1) - # ccall(:jl_sockaddr_host6,Uint32,(Ptr{Void},Ptr{Uint128}),sockaddrr,host) + # host = Array(UInt128,1) + # ccall(:jl_sockaddr_host6,UInt32,(Ptr{Void},Ptr{UInt128}),sockaddrr,host) # return IPv6(ntoh(host[1])) end end - ccall(:uv_free_interface_addresses,Void,(Ptr{Uint8},Int32),addr,count) + ccall(:uv_free_interface_addresses,Void,(Ptr{UInt8},Int32),addr,count) lo_present ? ip"127.0.0.1" : error("No networking interface available") end @@ -586,20 +586,20 @@ end function connect!(sock::TCPSocket, host::IPv4, port::Integer) @assert sock.status == StatusInit - if !(0 <= port <= typemax(Uint16)) + if !(0 <= port <= typemax(UInt16)) throw(DomainError()) end - uv_error("connect",ccall(:jl_tcp4_connect,Int32,(Ptr{Void},Uint32,Uint16), + uv_error("connect",ccall(:jl_tcp4_connect,Int32,(Ptr{Void},UInt32,UInt16), sock.handle,hton(host.host),hton(uint16(port)))) sock.status = StatusConnecting end function connect!(sock::TCPSocket, host::IPv6, port::Integer) @assert sock.status == StatusInit - if !(0 <= port <= typemax(Uint16)) + if !(0 <= port <= typemax(UInt16)) throw(DomainError()) end - uv_error("connect",ccall(:jl_tcp6_connect,Int32,(Ptr{Void},Ptr{Uint128},Uint16), + uv_error("connect",ccall(:jl_tcp6_connect,Int32,(Ptr{Void},Ptr{UInt128},UInt16), sock.handle,&hton(host.host),hton(uint16(port)))) sock.status = StatusConnecting end diff --git a/base/stat.jl b/base/stat.jl index ed0b76743d345..8f6de827e224a 100644 --- a/base/stat.jl +++ b/base/stat.jl @@ -1,11 +1,11 @@ immutable StatStruct - device :: Uint - inode :: Uint - mode :: Uint + device :: UInt + inode :: UInt + mode :: UInt nlink :: Int - uid :: Uint - gid :: Uint - rdev :: Uint + uid :: UInt + gid :: UInt + rdev :: UInt size :: Int64 blksize :: Int64 blocks :: Int64 @@ -13,30 +13,30 @@ immutable StatStruct ctime :: Float64 end -StatStruct(buf::Union(Vector{Uint8},Ptr{Uint8})) = StatStruct( - uint(ccall(:jl_stat_dev, Uint32, (Ptr{Uint8},), buf)), - uint(ccall(:jl_stat_ino, Uint32, (Ptr{Uint8},), buf)), - uint(ccall(:jl_stat_mode, Uint32, (Ptr{Uint8},), buf)), - int(ccall(:jl_stat_nlink, Uint32, (Ptr{Uint8},), buf)), - uint(ccall(:jl_stat_uid, Uint32, (Ptr{Uint8},), buf)), - uint(ccall(:jl_stat_gid, Uint32, (Ptr{Uint8},), buf)), - uint(ccall(:jl_stat_rdev, Uint32, (Ptr{Uint8},), buf)), - int64(ccall(:jl_stat_size, Uint64, (Ptr{Uint8},), buf)), - int64(ccall(:jl_stat_blksize, Uint64, (Ptr{Uint8},), buf)), - int64(ccall(:jl_stat_blocks, Uint64, (Ptr{Uint8},), buf)), - ccall(:jl_stat_mtime, Float64, (Ptr{Uint8},), buf), - ccall(:jl_stat_ctime, Float64, (Ptr{Uint8},), buf), +StatStruct(buf::Union(Vector{UInt8},Ptr{UInt8})) = StatStruct( + uint(ccall(:jl_stat_dev, UInt32, (Ptr{UInt8},), buf)), + uint(ccall(:jl_stat_ino, UInt32, (Ptr{UInt8},), buf)), + uint(ccall(:jl_stat_mode, UInt32, (Ptr{UInt8},), buf)), + int(ccall(:jl_stat_nlink, UInt32, (Ptr{UInt8},), buf)), + uint(ccall(:jl_stat_uid, UInt32, (Ptr{UInt8},), buf)), + uint(ccall(:jl_stat_gid, UInt32, (Ptr{UInt8},), buf)), + uint(ccall(:jl_stat_rdev, UInt32, (Ptr{UInt8},), buf)), + int64(ccall(:jl_stat_size, UInt64, (Ptr{UInt8},), buf)), + int64(ccall(:jl_stat_blksize, UInt64, (Ptr{UInt8},), buf)), + int64(ccall(:jl_stat_blocks, UInt64, (Ptr{UInt8},), buf)), + ccall(:jl_stat_mtime, Float64, (Ptr{UInt8},), buf), + ccall(:jl_stat_ctime, Float64, (Ptr{UInt8},), buf), ) show(io::IO, st::StatStruct) = print("StatStruct(mode=$(oct(st.mode,6)), size=$(st.size))") # stat & lstat functions -const stat_buf = Array(Uint8, ccall(:jl_sizeof_stat, Int32, ())) +const stat_buf = Array(UInt8, ccall(:jl_sizeof_stat, Int32, ())) macro stat_call(sym, arg1type, arg) quote fill!(stat_buf,0) - r = ccall($(Expr(:quote,sym)), Int32, ($arg1type, Ptr{Uint8}), $(esc(arg)), stat_buf) + r = ccall($(Expr(:quote,sym)), Int32, ($arg1type, Ptr{UInt8}), $(esc(arg)), stat_buf) r==0 || r==UV_ENOENT || r==UV_ENOTDIR || throw(UVError("stat",r)) st = StatStruct(stat_buf) if ispath(st) != (r==0) @@ -48,8 +48,8 @@ end stat(fd::RawFD) = @stat_call jl_fstat Int32 fd.fd stat(fd::Integer) = @stat_call jl_fstat Int32 fd -stat(path::AbstractString) = @stat_call jl_stat Ptr{Uint8} path -lstat(path::AbstractString) = @stat_call jl_lstat Ptr{Uint8} path +stat(path::AbstractString) = @stat_call jl_stat Ptr{UInt8} path +lstat(path::AbstractString) = @stat_call jl_lstat Ptr{UInt8} path stat(path...) = stat(joinpath(path...)) lstat(path...) = lstat(joinpath(path...)) diff --git a/base/statistics.jl b/base/statistics.jl index 877f70d159af7..38a3c13598ad0 100644 --- a/base/statistics.jl +++ b/base/statistics.jl @@ -30,7 +30,7 @@ end momenttype{T}(::Type{T}) = typeof((zero(T) + zero(T)) / 2) momenttype(::Type{Float32}) = Float32 -momenttype{T<:Union(Float64,Int32,Int64,Uint32,Uint64)}(::Type{T}) = Float64 +momenttype{T<:Union(Float64,Int32,Int64,UInt32,UInt64)}(::Type{T}) = Float64 mean{T}(A::AbstractArray{T}, region) = mean!(Array(momenttype(T), reduced_dims(size(A), region)), A) @@ -447,7 +447,7 @@ end ##### median & quantiles ##### -middle(x::Union(Bool,Int8,Int16,Int32,Int64,Int128,Uint8,Uint16,Uint32,Uint64,Uint128)) = float64(x) +middle(x::Union(Bool,Int8,Int16,Int32,Int64,Int128,UInt8,UInt16,UInt32,UInt64,UInt128)) = float64(x) middle(x::FloatingPoint) = x middle(x::Float16) = float32(x) middle(x::Real) = (x + zero(x)) / 1 diff --git a/base/stream.jl b/base/stream.jl index 65fb93d721a48..8aff047b423a5 100644 --- a/base/stream.jl +++ b/base/stream.jl @@ -303,7 +303,7 @@ function wait_connected(x) end end -function wait_readbyte(x::AsyncStream, c::Uint8) +function wait_readbyte(x::AsyncStream, c::UInt8) while isopen(x) && search(x.buffer,c) <= 0 start_reading(x) stream_wait(x,x.readnotify) @@ -351,18 +351,18 @@ end ## BUFFER ## ## Allocate a simple buffer -function alloc_request(buffer::IOBuffer, recommended_size::Uint) +function alloc_request(buffer::IOBuffer, recommended_size::UInt) ensureroom(buffer, int(recommended_size)) ptr = buffer.append ? buffer.size + 1 : buffer.ptr return (pointer(buffer.data, ptr), length(buffer.data)-ptr+1) end -function _uv_hook_alloc_buf(stream::AsyncStream, recommended_size::Uint) +function _uv_hook_alloc_buf(stream::AsyncStream, recommended_size::UInt) (buf,size) = alloc_request(stream.buffer, recommended_size) @assert size>0 # because libuv requires this (TODO: possibly stop reading too if it fails) (buf,uint(size)) end -function notify_filled(buffer::IOBuffer, nread::Int, base::Ptr{Void}, len::Uint) +function notify_filled(buffer::IOBuffer, nread::Int, base::Ptr{Void}, len::UInt) if buffer.append buffer.size += nread else @@ -386,7 +386,7 @@ function notify_filled(stream::AsyncStream, nread::Int) end const READ_BUFFER_SZ=10485760 # 10 MB -function _uv_hook_readcb(stream::AsyncStream, nread::Int, base::Ptr{Void}, len::Uint) +function _uv_hook_readcb(stream::AsyncStream, nread::Int, base::Ptr{Void}, len::UInt) if nread < 0 if nread != UV_EOF # This is a fatal connectin error. Shutdown requests as per the usual @@ -480,7 +480,7 @@ _uv_hook_close(uv::AsyncWork) = (uv.handle = C_NULL; nothing) # This serves as a common callback for all async classes function _uv_hook_asynccb(async::AsyncWork) if isa(async, Timer) - if ccall(:uv_timer_get_repeat, Uint64, (Ptr{Void},), async.handle) == 0 + if ccall(:uv_timer_get_repeat, UInt64, (Ptr{Void},), async.handle) == 0 # timer is stopped now disassociate_julia_struct(async.handle) end @@ -496,7 +496,7 @@ function start_timer(timer::Timer, timeout::Real, repeat::Real) associate_julia_struct(timer.handle, timer) preserve_handle(timer) ccall(:uv_update_time,Void,(Ptr{Void},),eventloop()) - ccall(:uv_timer_start,Cint,(Ptr{Void},Ptr{Void},Uint64,Uint64), + ccall(:uv_timer_start,Cint,(Ptr{Void},Ptr{Void},UInt64,UInt64), timer.handle, uv_jl_asynccb::Ptr{Void}, uint64(round(timeout*1000))+1, uint64(round(repeat*1000))) end @@ -656,11 +656,11 @@ end function read!{T}(s::AsyncStream, a::Array{T}) isbits(T) || error("read from buffer only supports bits types or arrays of bits types") nb = length(a) * sizeof(T) - read!(s, reshape(reinterpret(Uint8, a), nb)) + read!(s, reshape(reinterpret(UInt8, a), nb)) return a end -function read!(s::AsyncStream, a::Vector{Uint8}) +function read!(s::AsyncStream, a::Vector{UInt8}) nb = length(a) sbuf = s.buffer @assert sbuf.seekable == false @@ -688,15 +688,15 @@ end function read{T}(s::AsyncStream, ::Type{T}, dims::Dims) isbits(T) || error("read from buffer only supports bits types or arrays of bits types") nb = prod(dims)*sizeof(T) - a = read!(s, Array(Uint8, nb)) + a = read!(s, Array(UInt8, nb)) reshape(reinterpret(T, a), dims) end -function read(this::AsyncStream,::Type{Uint8}) +function read(this::AsyncStream,::Type{UInt8}) buf = this.buffer @assert buf.seekable == false wait_readnb(this,1) - read(buf,Uint8) + read(buf,UInt8) end readline(this::AsyncStream) = readuntil(this, '\n') @@ -710,7 +710,7 @@ function readavailable(this::AsyncStream) takebuf_string(buf) end -function readuntil(this::AsyncStream,c::Uint8) +function readuntil(this::AsyncStream,c::UInt8) buf = this.buffer @assert buf.seekable == false wait_readbyte(this,c) @@ -742,14 +742,14 @@ end function write!{T}(s::AsyncStream, a::Array{T}) if isbits(T) n = uint(length(a)*sizeof(T)) - @uv_write n ccall(:jl_write_no_copy, Int32, (Ptr{Void}, Ptr{Void}, Uint, Ptr{Void}, Ptr{Void}), handle(s), a, n, uvw, uv_jl_writecb::Ptr{Void}) + @uv_write n ccall(:jl_write_no_copy, Int32, (Ptr{Void}, Ptr{Void}, UInt, Ptr{Void}, Ptr{Void}), handle(s), a, n, uvw, uv_jl_writecb::Ptr{Void}) return int(length(a)*sizeof(T)) else throw(MethodError(write,(s,a))) end end function write!(s::AsyncStream, p::Ptr, nb::Integer) - @uv_write nb ccall(:jl_write_no_copy, Int32, (Ptr{Void}, Ptr{Void}, Uint, Ptr{Void}, Ptr{Void}), handle(s), p, nb, uvw, uv_jl_writecb::Ptr{Void}) + @uv_write nb ccall(:jl_write_no_copy, Int32, (Ptr{Void}, Ptr{Void}, UInt, Ptr{Void}, Ptr{Void}), handle(s), p, nb, uvw, uv_jl_writecb::Ptr{Void}) return nb end write!(s::AsyncStream, string::ByteString) = write!(s,string.data) @@ -762,8 +762,8 @@ function _uv_hook_writecb(s::AsyncStream, req::Ptr{Void}, status::Int32) nothing end -function write(s::AsyncStream, b::Uint8) - @uv_write 1 ccall(:jl_putc_copy, Int32, (Uint8, Ptr{Void}, Ptr{Void}, Ptr{Void}), b, handle(s), uvw, uv_jl_writecb_task::Ptr{Void}) +function write(s::AsyncStream, b::UInt8) + @uv_write 1 ccall(:jl_putc_copy, Int32, (UInt8, Ptr{Void}, Ptr{Void}, Ptr{Void}), b, handle(s), uvw, uv_jl_writecb_task::Ptr{Void}) ct = current_task() uv_req_set_data(uvw,ct) ct.state = :waiting @@ -771,7 +771,7 @@ function write(s::AsyncStream, b::Uint8) return 1 end function write(s::AsyncStream, c::Char) - @uv_write utf8sizeof(c) ccall(:jl_pututf8_copy, Int32, (Ptr{Void},Uint32, Ptr{Void}, Ptr{Void}), handle(s), c, uvw, uv_jl_writecb_task::Ptr{Void}) + @uv_write utf8sizeof(c) ccall(:jl_pututf8_copy, Int32, (Ptr{Void},UInt32, Ptr{Void}, Ptr{Void}), handle(s), c, uvw, uv_jl_writecb_task::Ptr{Void}) ct = current_task() uv_req_set_data(uvw,ct) ct.state = :waiting @@ -781,7 +781,7 @@ end function write{T}(s::AsyncStream, a::Array{T}) if isbits(T) n = uint(length(a)*sizeof(T)) - @uv_write n ccall(:jl_write_no_copy, Int32, (Ptr{Void}, Ptr{Void}, Uint, Ptr{Void}, Ptr{Void}), handle(s), a, n, uvw, uv_jl_writecb_task::Ptr{Void}) + @uv_write n ccall(:jl_write_no_copy, Int32, (Ptr{Void}, Ptr{Void}, UInt, Ptr{Void}, Ptr{Void}), handle(s), a, n, uvw, uv_jl_writecb_task::Ptr{Void}) ct = current_task() uv_req_set_data(uvw,ct) ct.state = :waiting @@ -793,7 +793,7 @@ function write{T}(s::AsyncStream, a::Array{T}) end end function write(s::AsyncStream, p::Ptr, nb::Integer) - @uv_write nb ccall(:jl_write_no_copy, Int32, (Ptr{Void}, Ptr{Void}, Uint, Ptr{Void}, Ptr{Void}), handle(s), p, nb, uvw, uv_jl_writecb_task::Ptr{Void}) + @uv_write nb ccall(:jl_write_no_copy, Int32, (Ptr{Void}, Ptr{Void}, UInt, Ptr{Void}, Ptr{Void}), handle(s), p, nb, uvw, uv_jl_writecb_task::Ptr{Void}) ct = current_task() uv_req_set_data(uvw,ct) ct.state = :waiting @@ -822,8 +822,8 @@ type UVError <: Exception UVError(p::AbstractString,code::Integer)=new(p,int32(code)) end -struverror(err::UVError) = bytestring(ccall(:uv_strerror,Ptr{Uint8},(Int32,),err.code)) -uverrorname(err::UVError) = bytestring(ccall(:uv_err_name,Ptr{Uint8},(Int32,),err.code)) +struverror(err::UVError) = bytestring(ccall(:uv_strerror,Ptr{UInt8},(Int32,),err.code)) +uverrorname(err::UVError) = bytestring(ccall(:uv_err_name,Ptr{UInt8},(Int32,),err.code)) uv_error(prefix::Symbol, c::Integer) = uv_error(string(prefix),c) uv_error(prefix::AbstractString, c::Integer) = c < 0 ? throw(UVError(prefix,c)) : nothing @@ -876,7 +876,7 @@ end function bind(server::PipeServer, name::ASCIIString) @assert server.status == StatusInit - err = ccall(:uv_pipe_bind, Int32, (Ptr{Void}, Ptr{Uint8}), + err = ccall(:uv_pipe_bind, Int32, (Ptr{Void}, Ptr{UInt8}), server.handle, name) if err != 0 if err != UV_EADDRINUSE && err != UV_EACCES @@ -901,7 +901,7 @@ function connect!(sock::Pipe, path::ByteString) @assert sock.status == StatusInit req = c_malloc(_sizeof_uv_connect) uv_req_set_data(req,C_NULL) - ccall(:uv_pipe_connect, Void, (Ptr{Void}, Ptr{Void}, Ptr{Uint8}, Ptr{Void}), req, sock.handle, path, uv_jl_connectcb::Ptr{Void}) + ccall(:uv_pipe_connect, Void, (Ptr{Void}, Ptr{Void}, Ptr{UInt8}, Ptr{Void}), req, sock.handle, path, uv_jl_connectcb::Ptr{Void}) sock.status = StatusConnecting sock end diff --git a/base/string.jl b/base/string.jl index ce0f0c1f58d79..111dd433aefd3 100644 --- a/base/string.jl +++ b/base/string.jl @@ -18,7 +18,7 @@ next(s::AbstractString, i::Integer) = next(s,int(i)) function print_to_string(xs...) # specialized for performance reasons - s = IOBuffer(Array(Uint8,isa(xs[1],AbstractString) ? endof(xs[1]) : 0), true, true) + s = IOBuffer(Array(UInt8,isa(xs[1],AbstractString) ? endof(xs[1]) : 0), true, true) truncate(s,0) for x in xs print(s, x) @@ -31,21 +31,21 @@ string(s::AbstractString) = s string(xs...) = print_to_string(xs...) bytestring() = "" -bytestring(s::Array{Uint8,1}) = bytestring(pointer(s),length(s)) +bytestring(s::Array{UInt8,1}) = bytestring(pointer(s),length(s)) bytestring(s::AbstractString...) = print_to_string(s...) -function bytestring(p::Union(Ptr{Uint8},Ptr{Int8})) +function bytestring(p::Union(Ptr{UInt8},Ptr{Int8})) p == C_NULL ? error("cannot convert NULL to string") : - ccall(:jl_cstr_to_string, ByteString, (Ptr{Uint8},), p) + ccall(:jl_cstr_to_string, ByteString, (Ptr{UInt8},), p) end -function bytestring(p::Union(Ptr{Uint8},Ptr{Int8}),len::Integer) +function bytestring(p::Union(Ptr{UInt8},Ptr{Int8}),len::Integer) p == C_NULL ? error("cannot convert NULL to string") : - ccall(:jl_pchar_to_string, ByteString, (Ptr{Uint8},Int), p, len) + ccall(:jl_pchar_to_string, ByteString, (Ptr{UInt8},Int), p, len) end -convert(::Type{Array{Uint8,1}}, s::AbstractString) = bytestring(s).data -convert(::Type{Array{Uint8}}, s::AbstractString) = bytestring(s).data +convert(::Type{Array{UInt8,1}}, s::AbstractString) = bytestring(s).data +convert(::Type{Array{UInt8}}, s::AbstractString) = bytestring(s).data convert(::Type{ByteString}, s::AbstractString) = bytestring(s) convert(::Type{Array{Char,1}}, s::AbstractString) = collect(s) convert(::Type{Symbol}, s::AbstractString) = symbol(s) @@ -296,7 +296,7 @@ function _searchindex(s::Array, t::Array, i) 0 end -searchindex(s::Union(Array{Uint8,1},Array{Int8,1}),t::Union(Array{Uint8,1},Array{Int8,1}),i) = _searchindex(s,t,i) +searchindex(s::Union(Array{UInt8,1},Array{Int8,1}),t::Union(Array{UInt8,1},Array{Int8,1}),i) = _searchindex(s,t,i) searchindex(s::AbstractString, t::AbstractString, i::Integer) = _searchindex(s,t,i) searchindex(s::AbstractString, t::AbstractString) = searchindex(s,t,start(s)) @@ -308,7 +308,7 @@ function searchindex(s::ByteString, t::ByteString, i::Integer=1) end end -function search(s::Union(Array{Uint8,1},Array{Int8,1}),t::Union(Array{Uint8,1},Array{Int8,1}),i) +function search(s::Union(Array{UInt8,1},Array{Int8,1}),t::Union(Array{UInt8,1},Array{Int8,1}),i) idx = searchindex(s,t,i) if isempty(t) idx:idx-1 @@ -428,7 +428,7 @@ function _rsearchindex(s::Array, t::Array, k) 0 end -rsearchindex(s::Union(Array{Uint8,1},Array{Int8,1}),t::Union(Array{Uint8,1},Array{Int8,1}),i) = _rsearchindex(s,t,i) +rsearchindex(s::Union(Array{UInt8,1},Array{Int8,1}),t::Union(Array{UInt8,1},Array{Int8,1}),i) = _rsearchindex(s,t,i) rsearchindex(s::AbstractString, t::AbstractString, i::Integer) = _rsearchindex(s,t,i) rsearchindex(s::AbstractString, t::AbstractString) = (isempty(s) && isempty(t)) ? 1 : rsearchindex(s,t,endof(s)) @@ -448,7 +448,7 @@ function rsearchindex(s::ByteString, t::ByteString, i::Integer) end end -function rsearch(s::Union(Array{Uint8,1},Array{Int8,1}),t::Union(Array{Uint8,1},Array{Int8,1}),i) +function rsearch(s::Union(Array{UInt8,1},Array{Int8,1}),t::Union(Array{UInt8,1},Array{Int8,1}),i) idx = rsearchindex(s,t,i) if isempty(t) idx:idx-1 @@ -523,22 +523,22 @@ endswith(str::AbstractString, chars::Chars) = !isempty(str) && str[end] in chars # faster comparisons for byte strings and symbols cmp(a::ByteString, b::ByteString) = lexcmp(a.data, b.data) -cmp(a::Symbol, b::Symbol) = int(sign(ccall(:strcmp, Int32, (Ptr{Uint8}, Ptr{Uint8}), a, b))) +cmp(a::Symbol, b::Symbol) = int(sign(ccall(:strcmp, Int32, (Ptr{UInt8}, Ptr{UInt8}), a, b))) ==(a::ByteString, b::ByteString) = endof(a) == endof(b) && cmp(a,b) == 0 isless(a::Symbol, b::Symbol) = cmp(a,b) < 0 beginswith(a::ByteString, b::ByteString) = beginswith(a.data, b.data) -beginswith(a::Array{Uint8,1}, b::Array{Uint8,1}) = - (length(a) >= length(b) && ccall(:strncmp, Int32, (Ptr{Uint8}, Ptr{Uint8}, Uint), a, b, length(b)) == 0) +beginswith(a::Array{UInt8,1}, b::Array{UInt8,1}) = + (length(a) >= length(b) && ccall(:strncmp, Int32, (Ptr{UInt8}, Ptr{UInt8}, UInt), a, b, length(b)) == 0) # TODO: fast endswith ## character column width function ## -charwidth(c::Char) = max(0,int(ccall(:wcwidth, Int32, (Uint32,), c))) +charwidth(c::Char) = max(0,int(ccall(:wcwidth, Int32, (UInt32,), c))) strwidth(s::AbstractString) = (w=0; for c in s; w += charwidth(c); end; w) -strwidth(s::ByteString) = int(ccall(:u8_strwidth, Csize_t, (Ptr{Uint8},), s.data)) +strwidth(s::ByteString) = int(ccall(:u8_strwidth, Csize_t, (Ptr{UInt8},), s.data)) # TODO: implement and use u8_strnwidth that takes a length argument isascii(c::Char) = c < char(0x80) @@ -596,7 +596,7 @@ sizeof{T<:ByteString}(s::SubString{T}) = s.endof==0 ? 0 : next(s,s.endof)[2]-1 length{T<:DirectIndexString}(s::SubString{T}) = endof(s) function length(s::SubString{UTF8String}) - return s.endof==0 ? 0 : int(ccall(:u8_charnum, Csize_t, (Ptr{Uint8}, Csize_t), + return s.endof==0 ? 0 : int(ccall(:u8_charnum, Csize_t, (Ptr{UInt8}, Csize_t), pointer(s), next(s,s.endof)[2]-1)) end @@ -645,7 +645,7 @@ function getindex(s::AbstractString, r::UnitRange{Int}) SubString(s, first(r), last(r)) end -function convert{P<:Union(Int8,Uint8),T<:ByteString}(::Type{Ptr{P}}, s::SubString{T}) +function convert{P<:Union(Int8,UInt8),T<:ByteString}(::Type{Ptr{P}}, s::SubString{T}) if s.offset+s.endof < endof(s.string) error("a SubString must coincide with the end of the original string to be convertible to pointer") end @@ -656,14 +656,14 @@ isascii(s::SubString{ASCIIString}) = true ## hashing strings ## -const memhash = Uint === Uint64 ? :memhash_seed : :memhash32_seed -const memhash_seed = Uint === Uint64 ? 0x71e729fd56419c81 : 0x56419c81 +const memhash = UInt === UInt64 ? :memhash_seed : :memhash32_seed +const memhash_seed = UInt === UInt64 ? 0x71e729fd56419c81 : 0x56419c81 -function hash{T<:ByteString}(s::Union(T,SubString{T}), h::Uint) +function hash{T<:ByteString}(s::Union(T,SubString{T}), h::UInt) h += memhash_seed - ccall(memhash, Uint, (Ptr{Uint8}, Csize_t, Uint32), s, sizeof(s), h % Uint32) + h + ccall(memhash, UInt, (Ptr{UInt8}, Csize_t, UInt32), s, sizeof(s), h % UInt32) + h end -hash(s::AbstractString, h::Uint) = hash(bytestring(s), h) +hash(s::AbstractString, h::UInt) = hash(bytestring(s), h) ## efficient representation of repeated strings ## @@ -711,7 +711,7 @@ function repeat(s::ByteString, r::Integer) error("can't repeat a string ",r," times") end d = s.data; n = length(d) - out = Array(Uint8, n*r) + out = Array(UInt8, n*r) for i=1:r copy!(out, 1+(i-1)*n, d, 1, n) end @@ -802,11 +802,11 @@ end ## string map, filter, has ## -map_result(s::AbstractString, a::Vector{Uint8}) = UTF8String(a) -map_result(s::Union(ASCIIString,SubString{ASCIIString}), a::Vector{Uint8}) = bytestring(a) +map_result(s::AbstractString, a::Vector{UInt8}) = UTF8String(a) +map_result(s::Union(ASCIIString,SubString{ASCIIString}), a::Vector{UInt8}) = bytestring(a) function map(f::Function, s::AbstractString) - out = IOBuffer(Array(Uint8,endof(s)),true,true) + out = IOBuffer(Array(UInt8,endof(s)),true,true) truncate(out,0) for c in s c2 = f(c) @@ -819,7 +819,7 @@ function map(f::Function, s::AbstractString) end function filter(f::Function, s::AbstractString) - out = IOBuffer(Array(Uint8,endof(s)),true,true) + out = IOBuffer(Array(UInt8,endof(s)),true,true) truncate(out,0) for c in s if f(c) @@ -954,15 +954,15 @@ unescape_string(s::AbstractString) = sprint(endof(s), print_unescaped, s) ## checking UTF-8 & ACSII validity ## -byte_string_classify(data::Array{Uint8,1}) = - ccall(:u8_isvalid, Int32, (Ptr{Uint8}, Int), data, length(data)) +byte_string_classify(data::Array{UInt8,1}) = + ccall(:u8_isvalid, Int32, (Ptr{UInt8}, Int), data, length(data)) byte_string_classify(s::ByteString) = byte_string_classify(s.data) # 0: neither valid ASCII nor UTF-8 # 1: valid ASCII # 2: valid UTF-8 -is_valid_ascii(s::Union(Array{Uint8,1},ByteString)) = byte_string_classify(s) == 1 -is_valid_utf8 (s::Union(Array{Uint8,1},ByteString)) = byte_string_classify(s) != 0 +is_valid_ascii(s::Union(Array{UInt8,1},ByteString)) = byte_string_classify(s) == 1 +is_valid_utf8 (s::Union(Array{UInt8,1},ByteString)) = byte_string_classify(s) != 0 ## multiline strings ## @@ -987,7 +987,7 @@ end function unindent(s::AbstractString, indent::Int) indent == 0 && return s - buf = IOBuffer(Array(Uint8,endof(s)), true, true) + buf = IOBuffer(Array(UInt8,endof(s)), true, true) truncate(buf,0) a = i = start(s) cutting = false @@ -1216,7 +1216,7 @@ shell_escape(args::AbstractString...) = sprint(print_shell_escaped, args...) function parse(str::AbstractString, pos::Int; greedy::Bool=true, raise::Bool=true) # returns (expr, end_pos). expr is () in case of parse error. ex, pos = ccall(:jl_parse_string, Any, - (Ptr{Uint8}, Int32, Int32), + (Ptr{UInt8}, Int32, Int32), str, pos-1, greedy ? 1:0) if raise && isa(ex,Expr) && is(ex.head,:error) throw(ParseError(ex.args[1])) @@ -1405,7 +1405,7 @@ chomp(s::ByteString) = function chomp!(s::ByteString) if !isempty(s) && s.data[end] == 0x0a n = (endof(s) < 2 || s.data[end-1] != 0x0d) ? 1 : 2 - ccall(:jl_array_del_end, Void, (Any, Uint), s.data, n) + ccall(:jl_array_del_end, Void, (Any, UInt), s.data, n) end return s end @@ -1493,7 +1493,7 @@ function parseint_nocheck{T<:Integer}(::Type{T}, s::AbstractString, base::Int, a c, i = parseint_next(s,i) base = convert(T,base) ## FIXME: remove 128-bit specific code once 128-bit div doesn't rely on BigInt - m::T = T===Uint128 || T===Int128 ? typemax(T) : div(typemax(T)-base+1,base) + m::T = T===UInt128 || T===Int128 ? typemax(T) : div(typemax(T)-base+1,base) n::T = 0 while n <= m d::T = '0' <= c <= '9' ? c-'0' : @@ -1539,17 +1539,17 @@ parseint(s::AbstractString) = parseint_nocheck(Int,s,0) integer (s::AbstractString) = int(s) unsigned(s::AbstractString) = uint(s) int (s::AbstractString) = parseint(Int,s) -uint (s::AbstractString) = parseint(Uint,s) +uint (s::AbstractString) = parseint(UInt,s) int8 (s::AbstractString) = parseint(Int8,s) -uint8 (s::AbstractString) = parseint(Uint8,s) +uint8 (s::AbstractString) = parseint(UInt8,s) int16 (s::AbstractString) = parseint(Int16,s) -uint16 (s::AbstractString) = parseint(Uint16,s) +uint16 (s::AbstractString) = parseint(UInt16,s) int32 (s::AbstractString) = parseint(Int32,s) -uint32 (s::AbstractString) = parseint(Uint32,s) +uint32 (s::AbstractString) = parseint(UInt32,s) int64 (s::AbstractString) = parseint(Int64,s) -uint64 (s::AbstractString) = parseint(Uint64,s) +uint64 (s::AbstractString) = parseint(UInt64,s) int128 (s::AbstractString) = parseint(Int128,s) -uint128 (s::AbstractString) = parseint(Uint128,s) +uint128 (s::AbstractString) = parseint(UInt128,s) ## stringifying integers more efficiently ## @@ -1558,14 +1558,14 @@ string(x::Union(Int8,Int16,Int32,Int64,Int128)) = dec(x) ## string to float functions ## float64_isvalid(s::AbstractString, out::Array{Float64,1}) = - ccall(:jl_strtod, Int32, (Ptr{Uint8},Ptr{Float64}), s, out) == 0 + ccall(:jl_strtod, Int32, (Ptr{UInt8},Ptr{Float64}), s, out) == 0 float32_isvalid(s::AbstractString, out::Array{Float32,1}) = - ccall(:jl_strtof, Int32, (Ptr{Uint8},Ptr{Float32}), s, out) == 0 + ccall(:jl_strtof, Int32, (Ptr{UInt8},Ptr{Float32}), s, out) == 0 float64_isvalid(s::SubString, out::Array{Float64,1}) = - ccall(:jl_substrtod, Int32, (Ptr{Uint8},Csize_t,Cint,Ptr{Float64}), s.string, s.offset, s.endof, out) == 0 + ccall(:jl_substrtod, Int32, (Ptr{UInt8},Csize_t,Cint,Ptr{Float64}), s.string, s.offset, s.endof, out) == 0 float32_isvalid(s::SubString, out::Array{Float32,1}) = - ccall(:jl_substrtof, Int32, (Ptr{Uint8},Csize_t,Cint,Ptr{Float32}), s.string, s.offset, s.endof, out) == 0 + ccall(:jl_substrtof, Int32, (Ptr{UInt8},Csize_t,Cint,Ptr{Float32}), s.string, s.offset, s.endof, out) == 0 begin local tmp::Array{Float64,1} = Array(Float64,1) @@ -1599,14 +1599,14 @@ end # find the index of the first occurrence of a value in a byte array -typealias ByteArray Union(Array{Uint8,1},Array{Int8,1}) +typealias ByteArray Union(Array{UInt8,1},Array{Int8,1}) -function search(a::ByteArray, b::Union(Int8,Uint8), i::Integer) +function search(a::ByteArray, b::Union(Int8,UInt8), i::Integer) if i < 1 error(BoundsError) end n = length(a) if i > n return i == n+1 ? 0 : error(BoundsError) end p = pointer(a) - q = ccall(:memchr, Ptr{Uint8}, (Ptr{Uint8}, Int32, Csize_t), p+i-1, b, n-i+1) + q = ccall(:memchr, Ptr{UInt8}, (Ptr{UInt8}, Int32, Csize_t), p+i-1, b, n-i+1) q == C_NULL ? 0 : int(q-p+1) end function search(a::ByteArray, b::Char, i::Integer) @@ -1616,14 +1616,14 @@ function search(a::ByteArray, b::Char, i::Integer) search(a,string(b).data,i).start end end -search(a::ByteArray, b::Union(Int8,Uint8,Char)) = search(a,b,1) +search(a::ByteArray, b::Union(Int8,UInt8,Char)) = search(a,b,1) -function rsearch(a::Union(Array{Uint8,1},Array{Int8,1}), b::Union(Int8,Uint8), i::Integer) +function rsearch(a::Union(Array{UInt8,1},Array{Int8,1}), b::Union(Int8,UInt8), i::Integer) if i < 1 return i == 0 ? 0 : error(BoundsError) end n = length(a) if i > n return i == n+1 ? 0 : error(BoundsError) end p = pointer(a) - q = ccall(:memrchr, Ptr{Uint8}, (Ptr{Uint8}, Int32, Csize_t), p, b, i) + q = ccall(:memrchr, Ptr{UInt8}, (Ptr{UInt8}, Int32, Csize_t), p, b, i) q == C_NULL ? 0 : int(q-p+1) end function rsearch(a::ByteArray, b::Char, i::Integer) @@ -1633,7 +1633,7 @@ function rsearch(a::ByteArray, b::Char, i::Integer) rsearch(a,string(b).data,i).start end end -rsearch(a::ByteArray, b::Union(Int8,Uint8,Char)) = rsearch(a,b,length(a)) +rsearch(a::ByteArray, b::Union(Int8,UInt8,Char)) = rsearch(a,b,length(a)) # return a random string (often useful for temporary filenames/dirnames) let @@ -1646,7 +1646,7 @@ end function hex2bytes(s::ASCIIString) len = length(s) iseven(len) || error("string length must be even: $(repr(s))") - arr = zeros(Uint8, div(len,2)) + arr = zeros(UInt8, div(len,2)) i = j = 0 while i < len n = 0 @@ -1665,7 +1665,7 @@ function hex2bytes(s::ASCIIString) return arr end -bytes2hex{T<:Uint8}(arr::Array{T,1}) = join([hex(i,2) for i in arr]) +bytes2hex{T<:UInt8}(arr::Array{T,1}) = join([hex(i,2) for i in arr]) function repr(x) s = IOBuffer() diff --git a/base/sysinfo.jl b/base/sysinfo.jl index 5930f3abe02f7..99ab9c29a0341 100644 --- a/base/sysinfo.jl +++ b/base/sysinfo.jl @@ -34,22 +34,22 @@ function init_sysinfo() end type UV_cpu_info_t - model::Ptr{Uint8} + model::Ptr{UInt8} speed::Int32 - cpu_times!user::Uint64 - cpu_times!nice::Uint64 - cpu_times!sys::Uint64 - cpu_times!idle::Uint64 - cpu_times!irq::Uint64 + cpu_times!user::UInt64 + cpu_times!nice::UInt64 + cpu_times!sys::UInt64 + cpu_times!idle::UInt64 + cpu_times!irq::UInt64 end type CPUinfo model::ASCIIString speed::Int32 - cpu_times!user::Uint64 - cpu_times!nice::Uint64 - cpu_times!sys::Uint64 - cpu_times!idle::Uint64 - cpu_times!irq::Uint64 + cpu_times!user::UInt64 + cpu_times!nice::UInt64 + cpu_times!sys::UInt64 + cpu_times!idle::UInt64 + cpu_times!irq::UInt64 CPUinfo(model,speed,u,n,s,id,ir)=new(model,speed,u,n,s,id,ir) end CPUinfo(info::UV_cpu_info_t) = CPUinfo(bytestring(info.model), info.speed, @@ -136,8 +136,8 @@ function loadavg() return loadavg_ end -free_memory() = ccall(:uv_get_free_memory, Uint64, ()) -total_memory() = ccall(:uv_get_total_memory, Uint64, ()) +free_memory() = ccall(:uv_get_free_memory, UInt64, ()) +total_memory() = ccall(:uv_get_total_memory, UInt64, ()) if OS_NAME === :Darwin const dlext = "dylib" @@ -157,7 +157,7 @@ const shlib_ext = dlext addr::Cuint # Null-terminated name of object - name::Ptr{Uint8} + name::Ptr{UInt8} # Pointer to array of ELF program headers for this object phdr::Ptr{Void} @@ -193,7 +193,7 @@ function dllist() # start at 1 instead of 0 to skip self for i in 1:numImages-1 - name = bytestring(ccall( cglobal("_dyld_get_image_name"), Ptr{Uint8}, (Uint32,), uint32(i))) + name = bytestring(ccall( cglobal("_dyld_get_image_name"), Ptr{UInt8}, (UInt32,), uint32(i))) push!(dynamic_libraries, name) end end @@ -206,7 +206,7 @@ function dllist() end function dlpath( handle::Ptr{Void} ) - p = ccall( :jl_pathname_for_handle, Ptr{Uint8}, (Ptr{Void},), handle ) + p = ccall( :jl_pathname_for_handle, Ptr{UInt8}, (Ptr{Void},), handle ) s = bytestring(p) @windows_only c_free(p) return s diff --git a/base/task.jl b/base/task.jl index c3538cda3c1a8..f732343d1a2ec 100644 --- a/base/task.jl +++ b/base/task.jl @@ -292,7 +292,7 @@ end function pause() @unix_only ccall(:pause, Void, ()) - @windows_only ccall(:Sleep,stdcall, Void, (Uint32,), 0xffffffff) + @windows_only ccall(:Sleep,stdcall, Void, (UInt32,), 0xffffffff) end diff --git a/base/tuple.jl b/base/tuple.jl index 8ce9637e635e2..2e43deeeb50e1 100644 --- a/base/tuple.jl +++ b/base/tuple.jl @@ -86,11 +86,11 @@ function ==(t1::Tuple, t2::Tuple) return true end -const tuplehash_seed = Uint === Uint64 ? 0x77cfa1eef01bca90 : 0xf01bca90 -hash(::(), h::Uint) = h + tuplehash_seed -hash(x::(Any,), h::Uint) = hash(x[1], hash((), h)) -hash(x::(Any,Any), h::Uint) = hash(x[1], hash(x[2], hash((), h))) -hash(x::Tuple, h::Uint) = hash(x[1], hash(x[2], hash(tupletail(x), h))) +const tuplehash_seed = UInt === UInt64 ? 0x77cfa1eef01bca90 : 0xf01bca90 +hash(::(), h::UInt) = h + tuplehash_seed +hash(x::(Any,), h::UInt) = hash(x[1], hash((), h)) +hash(x::(Any,Any), h::UInt) = hash(x[1], hash(x[2], hash((), h))) +hash(x::Tuple, h::UInt) = hash(x[1], hash(x[2], hash(tupletail(x), h))) function isless(t1::Tuple, t2::Tuple) n1, n2 = length(t1), length(t2) diff --git a/base/utf16.jl b/base/utf16.jl index cb093cca8effe..1edf8c63b3739 100644 --- a/base/utf16.jl +++ b/base/utf16.jl @@ -1,6 +1,6 @@ immutable UTF16String <: AbstractString - data::Array{Uint16,1} # includes 16-bit NULL termination after string chars - function UTF16String(data::Vector{Uint16}) + data::Array{UInt16,1} # includes 16-bit NULL termination after string chars + function UTF16String(data::Vector{UInt16}) if length(data) < 1 || data[end] != 0 throw(ArgumentError("UTF16String data must be NULL-terminated")) end @@ -8,10 +8,10 @@ immutable UTF16String <: AbstractString end end -utf16_is_lead(c::Uint16) = (c & 0xfc00) == 0xd800 -utf16_is_trail(c::Uint16) = (c & 0xfc00) == 0xdc00 -utf16_is_surrogate(c::Uint16) = (c & 0xf800) == 0xd800 -utf16_get_supplementary(lead::Uint16, trail::Uint16) = char(uint32(lead-0xd7f7)<<10 + trail) +utf16_is_lead(c::UInt16) = (c & 0xfc00) == 0xd800 +utf16_is_trail(c::UInt16) = (c & 0xfc00) == 0xdc00 +utf16_is_surrogate(c::UInt16) = (c & 0xf800) == 0xd800 +utf16_get_supplementary(lead::UInt16, trail::UInt16) = char(uint32(lead-0xd7f7)<<10 + trail) function endof(s::UTF16String) d = s.data @@ -30,9 +30,9 @@ end # TODO: optmize this function encode16(s::AbstractString) - buf = Uint16[] + buf = UInt16[] for ch in s - c = reinterpret(Uint32, ch) + c = reinterpret(UInt32, ch) if c < 0x10000 push!(buf, uint16(c)) else @@ -47,18 +47,18 @@ end utf16(x) = convert(UTF16String, x) convert(::Type{UTF16String}, s::UTF16String) = s convert(::Type{UTF16String}, s::AbstractString) = encode16(s) -convert(::Type{Array{Uint16,1}}, s::UTF16String) = s.data -convert(::Type{Array{Uint16}}, s::UTF16String) = s.data +convert(::Type{Array{UInt16,1}}, s::UTF16String) = s.data +convert(::Type{Array{UInt16}}, s::UTF16String) = s.data # TODO: optimize this convert(::Type{UTF8String}, s::UTF16String) = sprint(length(s.data)-1, io->for c in s; write(io,c::Char); end) -sizeof(s::UTF16String) = sizeof(s.data) - sizeof(Uint16) -convert{T<:Union(Int16,Uint16)}(::Type{Ptr{T}}, s::UTF16String) = +sizeof(s::UTF16String) = sizeof(s.data) - sizeof(UInt16) +convert{T<:Union(Int16,UInt16)}(::Type{Ptr{T}}, s::UTF16String) = convert(Ptr{T}, pointer(s)) -function is_valid_utf16(data::AbstractArray{Uint16}) +function is_valid_utf16(data::AbstractArray{UInt16}) i = 1 n = length(data) # this may include NULL termination; that's okay while i < n # check for unpaired surrogates @@ -75,35 +75,35 @@ end is_valid_utf16(s::UTF16String) = is_valid_utf16(s.data) -function convert(::Type{UTF16String}, data::AbstractVector{Uint16}) +function convert(::Type{UTF16String}, data::AbstractVector{UInt16}) !is_valid_utf16(data) && throw(ArgumentError("invalid UTF16 data")) len = length(data) - d = Array(Uint16, len + 1) + d = Array(UInt16, len + 1) d[end] = 0 # NULL terminate UTF16String(copy!(d,1, data,1, len)) end -convert(T::Type{UTF16String}, data::AbstractArray{Uint16}) = +convert(T::Type{UTF16String}, data::AbstractArray{UInt16}) = convert(T, reshape(data, length(data))) convert(T::Type{UTF16String}, data::AbstractArray{Int16}) = - convert(T, reinterpret(Uint16, data)) + convert(T, reinterpret(UInt16, data)) -function convert(T::Type{UTF16String}, bytes::AbstractArray{Uint8}) - isempty(bytes) && return UTF16String(Uint16[0]) +function convert(T::Type{UTF16String}, bytes::AbstractArray{UInt8}) + isempty(bytes) && return UTF16String(UInt16[0]) isodd(length(bytes)) && throw(ArgumentError("odd number of bytes")) - data = reinterpret(Uint16, bytes) + data = reinterpret(UInt16, bytes) # check for byte-order mark (BOM): if data[1] == 0xfeff # native byte order - d = Array(Uint16, length(data)) + d = Array(UInt16, length(data)) copy!(d,1, data,2, length(data)-1) elseif data[1] == 0xfffe # byte-swapped - d = Array(Uint16, length(data)) + d = Array(UInt16, length(data)) for i = 2:length(data) d[i-1] = bswap(data[i]) end else - d = Array(Uint16, length(data) + 1) + d = Array(UInt16, length(data) + 1) copy!(d,1, data,1, length(data)) # assume native byte order end d[end] = 0 # NULL terminate @@ -111,9 +111,9 @@ function convert(T::Type{UTF16String}, bytes::AbstractArray{Uint8}) UTF16String(d) end -utf16(p::Ptr{Uint16}, len::Integer) = utf16(pointer_to_array(p, len)) -utf16(p::Ptr{Int16}, len::Integer) = utf16(convert(Ptr{Uint16}, p), len) -function utf16(p::Union(Ptr{Uint16}, Ptr{Int16})) +utf16(p::Ptr{UInt16}, len::Integer) = utf16(pointer_to_array(p, len)) +utf16(p::Ptr{Int16}, len::Integer) = utf16(convert(Ptr{UInt16}, p), len) +function utf16(p::Union(Ptr{UInt16}, Ptr{Int16})) len = 0 while unsafe_load(p, len+1) != 0; len += 1; end utf16(p, len) diff --git a/base/utf32.jl b/base/utf32.jl index 6dee962c930dd..32ca92097d539 100644 --- a/base/utf32.jl +++ b/base/utf32.jl @@ -45,14 +45,14 @@ function convert(::Type{UTF32String}, data::AbstractVector{Char}) UTF32String(copy!(d,1, data,1, len)) end -convert{T<:Union(Int32,Uint32)}(::Type{UTF32String}, data::AbstractVector{T}) = +convert{T<:Union(Int32,UInt32)}(::Type{UTF32String}, data::AbstractVector{T}) = convert(UTF32String, reinterpret(Char, data)) convert{T<:AbstractString}(::Type{T}, v::AbstractVector{Char}) = convert(T, utf32(v)) # specialize for performance reasons: function convert{T<:ByteString}(::Type{T}, data::AbstractVector{Char}) - s = IOBuffer(Array(Uint8,length(data)), true, true) + s = IOBuffer(Array(UInt8,length(data)), true, true) truncate(s,0) for x in data print(s, x) @@ -66,10 +66,10 @@ convert(::Type{Array{Char}}, s::UTF32String) = s.data reverse(s::UTF32String) = UTF32String(reverse!(copy(s.data), 1, length(s))) sizeof(s::UTF32String) = sizeof(s.data) - sizeof(Char) -convert{T<:Union(Int32,Uint32,Char)}(::Type{Ptr{T}}, s::UTF32String) = +convert{T<:Union(Int32,UInt32,Char)}(::Type{Ptr{T}}, s::UTF32String) = convert(Ptr{T}, pointer(s)) -function convert(T::Type{UTF32String}, bytes::AbstractArray{Uint8}) +function convert(T::Type{UTF32String}, bytes::AbstractArray{UInt8}) isempty(bytes) && return UTF32String(Char[0]) length(bytes) & 3 != 0 && throw(ArgumentError("need multiple of 4 bytes")) data = reinterpret(Char, bytes) @@ -91,8 +91,8 @@ function convert(T::Type{UTF32String}, bytes::AbstractArray{Uint8}) end utf32(p::Ptr{Char}, len::Integer) = utf32(pointer_to_array(p, len)) -utf32(p::Union(Ptr{Uint32}, Ptr{Int32}), len::Integer) = utf32(convert(Ptr{Char}, p), len) -function utf32(p::Union(Ptr{Char}, Ptr{Uint32}, Ptr{Int32})) +utf32(p::Union(Ptr{UInt32}, Ptr{Int32}), len::Integer) = utf32(convert(Ptr{Char}, p), len) +function utf32(p::Union(Ptr{Char}, Ptr{UInt32}, Ptr{Int32})) len = 0 while unsafe_load(p, len+1) != 0; len += 1; end utf32(p, len) diff --git a/base/utf8.jl b/base/utf8.jl index 0faac7066f713..47ea58ead2d8a 100644 --- a/base/utf8.jl +++ b/base/utf8.jl @@ -1,7 +1,7 @@ ## from base/boot.jl: # # immutable UTF8String <: AbstractString -# data::Array{Uint8,1} +# data::Array{UInt8,1} # end # @@ -24,7 +24,7 @@ const utf8_trailing = [ 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5, ] -is_utf8_start(byte::Uint8) = ((byte&0xc0)!=0x80) +is_utf8_start(byte::UInt8) = ((byte&0xc0)!=0x80) ## required core functionality ## @@ -37,17 +37,17 @@ function endof(s::UTF8String) end i end -length(s::UTF8String) = int(ccall(:u8_strlen, Csize_t, (Ptr{Uint8},), s.data)) +length(s::UTF8String) = int(ccall(:u8_strlen, Csize_t, (Ptr{UInt8},), s.data)) function next(s::UTF8String, i::Int) # potentially faster version # d = s.data - # a::Uint32 = d[i] + # a::UInt32 = d[i] # if a < 0x80; return char(a); end # #if a&0xc0==0x80; return '\ufffd'; end - # b::Uint32 = a<<6 + d[i+1] + # b::UInt32 = a<<6 + d[i+1] # if a < 0xe0; return char(b - 0x00003080); end - # c::Uint32 = b<<6 + d[i+2] + # c::UInt32 = b<<6 + d[i+2] # if a < 0xf0; return char(c - 0x000e2080); end # return char(c<<6 + d[i+3] - 0x03c82080) @@ -69,7 +69,7 @@ function next(s::UTF8String, i::Int) if length(d) < i + trailing return '\ufffd', i+1 end - c::Uint32 = 0 + c::UInt32 = 0 for j = 1:trailing+1 c <<= 6 c += d[i] @@ -80,7 +80,7 @@ function next(s::UTF8String, i::Int) end function first_utf8_byte(ch::Char) - c = reinterpret(Uint32, ch) + c = reinterpret(UInt32, ch) c < 0x80 ? uint8(c) : c < 0x800 ? uint8((c>>6) | 0xc0) : c < 0x10000 ? uint8((c>>12) | 0xe0) : @@ -94,7 +94,7 @@ sizeof(s::UTF8String) = sizeof(s.data) isvalid(s::UTF8String, i::Integer) = (1 <= i <= endof(s.data)) && is_utf8_start(s.data[i]) -const empty_utf8 = UTF8String(Uint8[]) +const empty_utf8 = UTF8String(UInt8[]) function getindex(s::UTF8String, r::UnitRange{Int}) isempty(r) && return empty_utf8 @@ -134,7 +134,7 @@ function string(a::ByteString...) return a[1]::UTF8String end # ^^ at least one must be UTF-8 or the ASCII-only method would get called - data = Array(Uint8,0) + data = Array(UInt8,0) for d in a append!(data,d.data) end @@ -143,7 +143,7 @@ end function reverse(s::UTF8String) out = similar(s.data) - if ccall(:u8_reverse, Cint, (Ptr{Uint8}, Ptr{Uint8}, Csize_t), + if ccall(:u8_reverse, Cint, (Ptr{UInt8}, Ptr{UInt8}, Csize_t), out, s.data, length(out)) == 1 error("invalid UTF-8 data") end @@ -160,8 +160,8 @@ write(io::IO, s::UTF8String) = write(io, s.data) utf8(x) = convert(UTF8String, x) convert(::Type{UTF8String}, s::UTF8String) = s convert(::Type{UTF8String}, s::ASCIIString) = UTF8String(s.data) -convert(::Type{UTF8String}, a::Array{Uint8,1}) = is_valid_utf8(a) ? UTF8String(a) : error("invalid UTF-8 sequence") -function convert(::Type{UTF8String}, a::Array{Uint8,1}, invalids_as::AbstractString) +convert(::Type{UTF8String}, a::Array{UInt8,1}) = is_valid_utf8(a) ? UTF8String(a) : error("invalid UTF-8 sequence") +function convert(::Type{UTF8String}, a::Array{UInt8,1}, invalids_as::AbstractString) l = length(a) idx = 1 iscopy = false diff --git a/base/utf8proc.jl b/base/utf8proc.jl index 53d11a8f02b41..38e91de29042d 100644 --- a/base/utf8proc.jl +++ b/base/utf8proc.jl @@ -61,17 +61,17 @@ const UTF8PROC_LUMP = (1<<12) const UTF8PROC_STRIPMARK = (1<<13) let - const p = Array(Ptr{Uint8}, 1) + const p = Array(Ptr{UInt8}, 1) global utf8proc_map function utf8proc_map(s::AbstractString, flags::Integer) result = ccall(:utf8proc_map, Cssize_t, - (Ptr{Uint8}, Cssize_t, Ptr{Ptr{Uint8}}, Cint), + (Ptr{UInt8}, Cssize_t, Ptr{Ptr{UInt8}}, Cint), s, 0, p, flags | UTF8PROC_NULLTERM) - result < 0 && error(bytestring(ccall(:utf8proc_errmsg, Ptr{Uint8}, + result < 0 && error(bytestring(ccall(:utf8proc_errmsg, Ptr{UInt8}, (Cssize_t,), result))) - a = ccall(:jl_ptr_to_array_1d, Vector{Uint8}, - (Any, Ptr{Uint8}, Csize_t, Cint), - Vector{Uint8}, p[1], result, true) + a = ccall(:jl_ptr_to_array_1d, Vector{UInt8}, + (Any, Ptr{UInt8}, Csize_t, Cint), + Vector{UInt8}, p[1], result, true) ccall(:jl_array_to_string, Any, (Any,), a)::ByteString end end @@ -113,7 +113,7 @@ end # returns UTF8PROC_CATEGORY code in 1:30 giving Unicode category function category_code(c) uint32(c) > 0x10FFFF && return 0x0000 # see utf8proc_get_property docs - cat = unsafe_load(ccall(:utf8proc_get_property, Ptr{Uint16}, (Int32,), c)) + cat = unsafe_load(ccall(:utf8proc_get_property, Ptr{UInt16}, (Int32,), c)) # note: utf8proc returns 0, not UTF8PROC_CATEGORY_CN, for unassigned c cat == 0 ? UTF8PROC_CATEGORY_CN : cat end @@ -124,7 +124,7 @@ is_assigned_char(c) = category_code(c) != UTF8PROC_CATEGORY_CN # used by character class predicates for improved performance function _catcode(c::Char) c > char(0x10FFFF) && return uint16(0x0000) # see utf8proc_get_property docs - return unsafe_load(ccall(:utf8proc_get_property, Ptr{Uint16}, (Int32,), c)) + return unsafe_load(ccall(:utf8proc_get_property, Ptr{UInt16}, (Int32,), c)) end # TODO: use UTF8PROC_CHARBOUND to extract graphemes from a string, e.g. to iterate over graphemes? diff --git a/base/util.jl b/base/util.jl index e817380bdd187..2269303af4b85 100644 --- a/base/util.jl +++ b/base/util.jl @@ -4,10 +4,10 @@ time() = ccall(:clock_now, Float64, ()) # high-resolution relative time, in nanoseconds -time_ns() = ccall(:jl_hrtime, Uint64, ()) +time_ns() = ccall(:jl_hrtime, UInt64, ()) # total time spend in garbage collection, in nanoseconds -gc_time_ns() = ccall(:jl_gc_total_hrtime, Uint64, ()) +gc_time_ns() = ccall(:jl_gc_total_hrtime, UInt64, ()) # total number of bytes allocated so far gc_bytes() = ccall(:jl_gc_total_bytes, Int64, ()) @@ -24,7 +24,7 @@ function toq() if is(timers,()) error("toc() without tic()") end - t0 = timers[1]::Uint64 + t0 = timers[1]::UInt64 task_local_storage(:TIMERS, timers[2]) (t1-t0)/1e9 end @@ -117,10 +117,10 @@ end if blas_vendor() == :openblas64 blasfunc(x) = string(x)*"64_" - openblas_get_config() = strip(bytestring( ccall((:openblas_get_config64_, Base.libblas_name), Ptr{Uint8}, () ))) + openblas_get_config() = strip(bytestring( ccall((:openblas_get_config64_, Base.libblas_name), Ptr{UInt8}, () ))) else blasfunc(x) = string(x) - openblas_get_config() = strip(bytestring( ccall((:openblas_get_config, Base.libblas_name), Ptr{Uint8}, () ))) + openblas_get_config() = strip(bytestring( ccall((:openblas_get_config, Base.libblas_name), Ptr{UInt8}, () ))) end function blas_set_num_threads(n::Integer) diff --git a/base/version.jl b/base/version.jl index 3ba27f29a2864..8a064770b60a4 100644 --- a/base/version.jl +++ b/base/version.jl @@ -150,8 +150,8 @@ function isless(a::VersionNumber, b::VersionNumber) return false end -function hash(v::VersionNumber, h::Uint) - h += 0x8ff4ffdb75f9fede % Uint +function hash(v::VersionNumber, h::UInt) + h += 0x8ff4ffdb75f9fede % UInt h = hash(v.major, h) h = hash(v.minor, h) h = hash(v.patch, h) diff --git a/doc/helpdb.jl b/doc/helpdb.jl index 19bacb35ac350..5a16d47b558e5 100644 --- a/doc/helpdb.jl +++ b/doc/helpdb.jl @@ -549,13 +549,13 @@ Any[ julia> structinfo(StatStruct) 12-element Array{(Int64,Symbol,DataType),1}: - (0,:device,Uint64) - (8,:inode,Uint64) - (16,:mode,Uint64) + (0,:device,UInt64) + (8,:inode,UInt64) + (16,:mode,UInt64) (24,:nlink,Int64) - (32,:uid,Uint64) - (40,:gid,Uint64) - (48,:rdev,Uint64) + (32,:uid,UInt64) + (40,:gid,UInt64) + (48,:rdev,UInt64) (56,:size,Int64) (64,:blksize,Int64) (72,:blocks,Int64) @@ -582,7 +582,7 @@ Any[ True if \"T\" is a \"plain data\" type, meaning it is immutable and contains no references to other values. Typical examples are - numeric types such as \"Uint8\", \"Float64\", and + numeric types such as \"UInt8\", \"Float64\", and \"Complex{Float64}\". julia> isbits(Complex{Float64}) @@ -1703,7 +1703,7 @@ Any[ "), -("Base","bytestring","bytestring(::Ptr{Uint8}[, length]) +("Base","bytestring","bytestring(::Ptr{UInt8}[, length]) Create a string from the address of a C (0-terminated) string encoded in ASCII or UTF-8. A copy is made; the ptr can be safely @@ -1720,7 +1720,7 @@ Any[ "), -("Base","ascii","ascii(::Array{Uint8, 1}) +("Base","ascii","ascii(::Array{UInt8, 1}) Create an ASCII string from a byte array. @@ -1733,7 +1733,7 @@ Any[ "), -("Base","utf8","utf8(::Array{Uint8, 1}) +("Base","utf8","utf8(::Array{UInt8, 1}) Create a UTF-8 string from a byte array. @@ -2218,7 +2218,7 @@ Any[ ("Base","utf16","utf16(s) - Create a UTF-16 string from a byte array, array of \"Uint16\", or + Create a UTF-16 string from a byte array, array of \"UInt16\", or any other string type. (Data must be valid UTF-16. Conversions of byte arrays check for a byte-order marker in the first two bytes, and do not include it in the resulting string.) @@ -2228,7 +2228,7 @@ Any[ the string (so that it is mostly invisible in Julia); this allows the string to be passed directly to external functions requiring NUL-terminated data. This NUL is appended automatically by the - *utf16(s)* conversion function. If you have a \"Uint16\" array + *utf16(s)* conversion function. If you have a \"UInt16\" array \"A\" that is already NUL-terminated valid UTF-16 data, then you can instead use *UTF16String(A)`* to construct the string without making a copy of the data and treating the NUL as a terminator @@ -2236,7 +2236,7 @@ Any[ "), -("Base","utf16","utf16(::Union(Ptr{Uint16}, Ptr{Int16})[, length]) +("Base","utf16","utf16(::Union(Ptr{UInt16}, Ptr{Int16})[, length]) Create a string from the address of a NUL-terminated UTF-16 string. A copy is made; the pointer can be safely freed. If \"length\" is @@ -2246,14 +2246,14 @@ Any[ ("Base","is_valid_utf16","is_valid_utf16(s) -> Bool - Returns true if the argument (\"UTF16String\" or \"Uint16\" array) + Returns true if the argument (\"UTF16String\" or \"UInt16\" array) is valid UTF-16. "), ("Base","utf32","utf32(s) - Create a UTF-32 string from a byte array, array of \"Uint32\", or + Create a UTF-32 string from a byte array, array of \"UInt32\", or any other string type. (Conversions of byte arrays check for a byte-order marker in the first four bytes, and do not include it in the resulting string.) @@ -2263,7 +2263,7 @@ Any[ the string (so that it is mostly invisible in Julia); this allows the string to be passed directly to external functions requiring NUL-terminated data. This NUL is appended automatically by the - *utf32(s)* conversion function. If you have a \"Uint32\" array + *utf32(s)* conversion function. If you have a \"UInt32\" array \"A\" that is already NUL-terminated UTF-32 data, then you can instead use *UTF32String(A)`* to construct the string without making a copy of the data and treating the NUL as a terminator @@ -2271,7 +2271,7 @@ Any[ "), -("Base","utf32","utf32(::Union(Ptr{Char}, Ptr{Uint32}, Ptr{Int32})[, length]) +("Base","utf32","utf32(::Union(Ptr{Char}, Ptr{UInt32}, Ptr{Int32})[, length]) Create a string from the address of a NUL-terminated UTF-32 string. A copy is made; the pointer can be safely freed. If \"length\" is @@ -2447,7 +2447,7 @@ Any[ "), -("Base","readbytes!","readbytes!(stream, b::Vector{Uint8}, nb=length(b)) +("Base","readbytes!","readbytes!(stream, b::Vector{UInt8}, nb=length(b)) Read at most \"nb\" bytes from the stream into \"b\", returning the number of bytes read (increasing the size of \"b\" as needed). @@ -2457,7 +2457,7 @@ Any[ ("Base","readbytes","readbytes(stream, nb=typemax(Int)) Read at most \"nb\" bytes from the stream, returning a - \"Vector{Uint8}\" of the bytes read. + \"Vector{UInt8}\" of the bytes read. "), @@ -2724,7 +2724,7 @@ Any[ "), -("Base","PipeBuffer","PipeBuffer(data::Vector{Uint8}[, maxsize]) +("Base","PipeBuffer","PipeBuffer(data::Vector{UInt8}[, maxsize]) Create a PipeBuffer to operate on a data vector, optionally specifying a size beyond which the underlying Array may not be @@ -2935,7 +2935,7 @@ Any[ "), -("Base","listenany","listenany(port_hint) -> (Uint16, TcpServer) +("Base","listenany","listenany(port_hint) -> (UInt16, TcpServer) Create a TcpServer on any port, using hint as a starting point. Returns a tuple of the actual port that the server was created on @@ -3275,7 +3275,7 @@ display(d::Display, mime, x) With these variants, one can also supply the \"raw\" data in the requested MIME type by passing \"x::AbstractString\" (for MIME types with text-based storage, such as text/html or - application/postscript) or \"x::Vector{Uint8}\" (for binary MIME + application/postscript) or \"x::Vector{UInt8}\" (for binary MIME types). "), @@ -3343,17 +3343,17 @@ displayable(d::Display, mime) -> Bool ("Base","reprmime","reprmime(mime, x) - Returns a \"AbstractString\" or \"Vector{Uint8}\" containing the + Returns a \"AbstractString\" or \"Vector{UInt8}\" containing the representation of \"x\" in the requested \"mime\" type, as written by \"writemime\" (throwing a \"MethodError\" if no appropriate \"writemime\" is available). A \"AbstractString\" is returned for MIME types with textual representations (such as \"\"text/html\"\" or \"\"application/postscript\"\"), whereas binary data is returned - as \"Vector{Uint8}\". (The function \"istext(mime)\" returns + as \"Vector{UInt8}\". (The function \"istext(mime)\" returns whether or not Julia treats a given \"mime\" type as text.) As a special case, if \"x\" is a \"AbstractString\" (for textual - MIME types) or a \"Vector{Uint8}\" (for binary MIME types), the + MIME types) or a \"Vector{UInt8}\" (for binary MIME types), the \"reprmime\" function assumes that \"x\" is already in the requested \"mime\" format and simply returns \"x\". @@ -5068,7 +5068,7 @@ popdisplay(d::Display) Convert an integer to a string in the given base, optionally specifying a number of digits to pad to. The base can be specified - as either an integer, or as a \"Uint8\" array of character values + as either an integer, or as a \"UInt8\" array of character values to use as digit symbols. "), @@ -5197,31 +5197,31 @@ popdisplay(d::Display) ("Base","uint8","uint8(x) - Convert a number or array to \"Uint8\" data type + Convert a number or array to \"UInt8\" data type "), ("Base","uint16","uint16(x) - Convert a number or array to \"Uint16\" data type + Convert a number or array to \"UInt16\" data type "), ("Base","uint32","uint32(x) - Convert a number or array to \"Uint32\" data type + Convert a number or array to \"UInt32\" data type "), ("Base","uint64","uint64(x) - Convert a number or array to \"Uint64\" data type + Convert a number or array to \"UInt64\" data type "), ("Base","uint128","uint128(x) - Convert a number or array to \"Uint128\" data type + Convert a number or array to \"UInt128\" data type "), @@ -5338,11 +5338,11 @@ popdisplay(d::Display) ("Base","hex2bytes","hex2bytes(s::ASCIIString) Convert an arbitrarily long hexadecimal string to its binary - representation. Returns an Array{Uint8, 1}, i.e. an array of bytes. + representation. Returns an Array{UInt8, 1}, i.e. an array of bytes. "), -("Base","bytes2hex","bytes2hex(bin_arr::Array{Uint8, 1}) +("Base","bytes2hex","bytes2hex(bin_arr::Array{UInt8, 1}) Convert an array of bytes to its hexadecimal representation. All characters are in lower-case. Returns an ASCIIString. @@ -5685,7 +5685,7 @@ popdisplay(d::Display) Reseed the random number generator. If a \"seed\" is provided, the RNG will give a reproducible sequence of numbers, otherwise Julia will get entropy from the system. The \"seed\" may be a non- - negative integer, a vector of \"Uint32\" integers or a filename, in + negative integer, a vector of \"UInt32\" integers or a filename, in which case the seed is read from a file. "), @@ -8251,7 +8251,7 @@ popdisplay(d::Display) ("Base","Cuchar","Cuchar - Equivalent to the native \"unsigned char\" c-type (Uint8) + Equivalent to the native \"unsigned char\" c-type (UInt8) "), @@ -8263,7 +8263,7 @@ popdisplay(d::Display) ("Base","Cushort","Cushort - Equivalent to the native \"unsigned short\" c-type (Uint16) + Equivalent to the native \"unsigned short\" c-type (UInt16) "), @@ -8275,7 +8275,7 @@ popdisplay(d::Display) ("Base","Cuint","Cuint - Equivalent to the native \"unsigned int\" c-type (Uint32) + Equivalent to the native \"unsigned int\" c-type (UInt32) "), @@ -8299,7 +8299,7 @@ popdisplay(d::Display) ("Base","Culonglong","Culonglong - Equivalent to the native \"unsigned long long\" c-type (Uint64) + Equivalent to the native \"unsigned long long\" c-type (UInt64) "), @@ -8311,13 +8311,13 @@ popdisplay(d::Display) ("Base","Cuintmax_t","Cuintmax_t - Equivalent to the native \"uintmax_t\" c-type (Uint64) + Equivalent to the native \"uintmax_t\" c-type (UInt64) "), ("Base","Csize_t","Csize_t - Equivalent to the native \"size_t\" c-type (Uint) + Equivalent to the native \"size_t\" c-type (UInt) "), diff --git a/doc/images/github_metadata_develbranch.png b/doc/images/github_metadata_develbranch.png index e79df04eaa8cc..1b1f34caad7bf 100644 Binary files a/doc/images/github_metadata_develbranch.png and b/doc/images/github_metadata_develbranch.png differ diff --git a/doc/images/github_metadata_fork.png b/doc/images/github_metadata_fork.png index 299ed2fe66616..2f47ca71f4288 100644 Binary files a/doc/images/github_metadata_fork.png and b/doc/images/github_metadata_fork.png differ diff --git a/doc/images/github_metadata_pullrequest.png b/doc/images/github_metadata_pullrequest.png index 1a99fb6255c02..0b97add946660 100644 Binary files a/doc/images/github_metadata_pullrequest.png and b/doc/images/github_metadata_pullrequest.png differ diff --git a/doc/images/travis-icon.png b/doc/images/travis-icon.png index d43fdbbb9f404..a550e117ba7d9 100644 Binary files a/doc/images/travis-icon.png and b/doc/images/travis-icon.png differ diff --git a/doc/manual/calling-c-and-fortran-code.rst b/doc/manual/calling-c-and-fortran-code.rst index 839b4a666e93a..b2988967604b6 100644 --- a/doc/manual/calling-c-and-fortran-code.rst +++ b/doc/manual/calling-c-and-fortran-code.rst @@ -69,21 +69,21 @@ is that a 1-tuple must be written with a trailing comma. For example, to call the ``getenv`` function to get a pointer to the value of an environment variable, one makes a call like this:: - julia> path = ccall( (:getenv, "libc"), Ptr{Uint8}, (Ptr{Uint8},), "SHELL") - Ptr{Uint8} @0x00007fff5fbffc45 + julia> path = ccall( (:getenv, "libc"), Ptr{UInt8}, (Ptr{UInt8},), "SHELL") + Ptr{UInt8} @0x00007fff5fbffc45 julia> bytestring(path) "/bin/bash" -Note that the argument type tuple must be written as ``(Ptr{Uint8},)``, -rather than ``(Ptr{Uint8})``. This is because ``(Ptr{Uint8})`` is just -``Ptr{Uint8}``, rather than a 1-tuple containing ``Ptr{Uint8}``:: +Note that the argument type tuple must be written as ``(Ptr{UInt8},)``, +rather than ``(Ptr{UInt8})``. This is because ``(Ptr{UInt8})`` is just +``Ptr{UInt8}``, rather than a 1-tuple containing ``Ptr{UInt8}``:: - julia> (Ptr{Uint8}) - Ptr{Uint8} + julia> (Ptr{UInt8}) + Ptr{UInt8} - julia> (Ptr{Uint8},) - (Ptr{Uint8},) + julia> (Ptr{UInt8},) + (Ptr{UInt8},) In practice, especially when providing reusable functionality, one generally wraps ``ccall`` uses in Julia functions that set up arguments @@ -97,7 +97,7 @@ in function getenv(var::AbstractString) val = ccall( (:getenv, "libc"), - Ptr{Uint8}, (Ptr{Uint8},), var) + Ptr{UInt8}, (Ptr{UInt8},), var) if val == C_NULL error("getenv: undefined variable: ", var) end @@ -120,11 +120,11 @@ Here is a slightly more complex example that discovers the local machine's hostname:: function gethostname() - hostname = Array(Uint8, 128) + hostname = Array(UInt8, 128) ccall( (:gethostname, "libc"), Int32, - (Ptr{Uint8}, Uint), + (Ptr{UInt8}, UInt), hostname, length(hostname)) - return bytestring(convert(Ptr{Uint8}, hostname)) + return bytestring(convert(Ptr{UInt8}, hostname)) end This example first allocates an array of bytes, then calls the C library @@ -217,23 +217,23 @@ Julia type with the same name, prefixed by C. This can help for writing portable **System-independent:** +------------------------+-------------------+--------------------------------+ -| ``unsigned char`` | ``Cuchar`` | ``Uint8`` | +| ``unsigned char`` | ``Cuchar`` | ``UInt8`` | +------------------------+-------------------+--------------------------------+ | ``short`` | ``Cshort`` | ``Int16`` | +------------------------+-------------------+--------------------------------+ -| ``unsigned short`` | ``Cushort`` | ``Uint16`` | +| ``unsigned short`` | ``Cushort`` | ``UInt16`` | +------------------------+-------------------+--------------------------------+ | ``int`` | ``Cint`` | ``Int32`` | +------------------------+-------------------+--------------------------------+ -| ``unsigned int`` | ``Cuint`` | ``Uint32`` | +| ``unsigned int`` | ``Cuint`` | ``UInt32`` | +------------------------+-------------------+--------------------------------+ | ``long long`` | ``Clonglong`` | ``Int64`` | +------------------------+-------------------+--------------------------------+ -| ``unsigned long long`` | ``Culonglong`` | ``Uint64`` | +| ``unsigned long long`` | ``Culonglong`` | ``UInt64`` | +------------------------+-------------------+--------------------------------+ | ``intmax_t`` | ``Cintmax_t`` | ``Int64`` | +------------------------+-------------------+--------------------------------+ -| ``uintmax_t`` | ``Cuintmax_t`` | ``Uint64`` | +| ``uintmax_t`` | ``Cuintmax_t`` | ``UInt64`` | +------------------------+-------------------+--------------------------------+ | ``float`` | ``Cfloat`` | ``Float32`` | +------------------------+-------------------+--------------------------------+ @@ -243,15 +243,15 @@ Julia type with the same name, prefixed by C. This can help for writing portable +------------------------+-------------------+--------------------------------+ | ``ssize_t`` | ``Cssize_t`` | ``Int`` | +------------------------+-------------------+--------------------------------+ -| ``size_t`` | ``Csize_t`` | ``Uint`` | +| ``size_t`` | ``Csize_t`` | ``UInt`` | +------------------------+-------------------+--------------------------------+ | ``void`` | | ``Void`` | +------------------------+-------------------+--------------------------------+ | ``void*`` | | ``Ptr{Void}`` | +------------------------+-------------------+--------------------------------+ -| ``char*`` (or ``char[]``, e.g. a string) | ``Ptr{Uint8}`` | +| ``char*`` (or ``char[]``, e.g. a string) | ``Ptr{UInt8}`` | +------------------------+-------------------+--------------------------------+ -| ``char**`` (or ``*char[]``) | ``Ptr{Ptr{Uint8}}`` | +| ``char**`` (or ``*char[]``) | ``Ptr{Ptr{UInt8}}`` | +------------------------+-------------------+--------------------------------+ | ``struct T*`` (where T represents an | ``Ptr{T}`` (call using | | appropriately defined bits type) | &variable_name in the | @@ -274,21 +274,21 @@ A C function declared to return ``void`` will give ``nothing`` in Julia. ====================== ============== ======= ``char`` ``Cchar`` ``Int8`` (x86, x86_64) - ``Uint8`` (powerpc, arm) + ``UInt8`` (powerpc, arm) ``long`` ``Clong`` ``Int`` (UNIX) ``Int32`` (Windows) -``unsigned long`` ``Culong`` ``Uint`` (UNIX) +``unsigned long`` ``Culong`` ``UInt`` (UNIX) - ``Uint32`` (Windows) + ``UInt32`` (Windows) ``wchar_t`` ``Cwchar_t`` ``Int32`` (UNIX) - ``Uint16`` (Windows) + ``UInt16`` (Windows) ====================== ============== ======= -For string arguments (``char*``) the Julia type should be ``Ptr{Uint8}``, +For string arguments (``char*``) the Julia type should be ``Ptr{UInt8}``, not ``ASCIIString``. C functions that take an argument of the type ``char**`` -can be called by using a ``Ptr{Ptr{Uint8}}`` type within Julia. For example, +can be called by using a ``Ptr{Ptr{UInt8}}`` type within Julia. For example, C functions of the form:: int main(int argc, char **argv); @@ -296,7 +296,7 @@ C functions of the form:: can be called via the following Julia code:: argv = [ "a.out", "arg1", "arg2" ] - ccall(:main, Int32, (Int32, Ptr{Ptr{Uint8}}), length(argv), argv) + ccall(:main, Int32, (Int32, Ptr{Ptr{UInt8}}), length(argv), argv) For ``wchar_t*`` arguments, the Julia type should be ``Ptr{Wchar_t}``, and data can be converted to/from ordinary Julia strings by the @@ -431,8 +431,8 @@ the platform-default C calling convention is used. Other supported conventions are: ``stdcall``, ``cdecl``, ``fastcall``, and ``thiscall``. For example (from base/libc.jl):: - hn = Array(Uint8, 256) - err=ccall(:gethostname, stdcall, Int32, (Ptr{Uint8}, Uint32), hn, length(hn)) + hn = Array(UInt8, 256) + err=ccall(:gethostname, stdcall, Int32, (Ptr{UInt8}, UInt32), hn, length(hn)) For more information, please see the `LLVM Language Reference`_. diff --git a/doc/manual/conversion-and-promotion.rst b/doc/manual/conversion-and-promotion.rst index 9b58d9efb11e3..723e24fe4ff90 100644 --- a/doc/manual/conversion-and-promotion.rst +++ b/doc/manual/conversion-and-promotion.rst @@ -78,11 +78,11 @@ action: julia> typeof(x) Int64 - julia> convert(Uint8, x) + julia> convert(UInt8, x) 0x0c julia> typeof(ans) - Uint8 + UInt8 julia> convert(FloatingPoint, x) 12.0 @@ -320,7 +320,7 @@ promoted together, they should be promoted to 64-bit floating-point. The promotion type does not need to be one of the argument types, however; the following promotion rules both occur in Julia's standard library:: - promote_rule(::Type{Uint8}, ::Type{Int8}) = Int + promote_rule(::Type{UInt8}, ::Type{Int8}) = Int promote_rule(::Type{BigInt}, ::Type{Int8}) = BigInt As a general rule, Julia promotes integers to `Int` during computation @@ -340,7 +340,7 @@ would promote to, one can use ``promote_type``: .. doctest:: - julia> promote_type(Int8, Uint16) + julia> promote_type(Int8, UInt16) Int64 Internally, ``promote_type`` is used inside of ``promote`` to determine diff --git a/doc/manual/faq.rst b/doc/manual/faq.rst index ba40ecbe51a6d..03c9f83b1ac2e 100644 --- a/doc/manual/faq.rst +++ b/doc/manual/faq.rst @@ -419,7 +419,7 @@ be inferred about an object of type ``MyAmbiguousType``: ``b`` and ``c`` have the same type, yet their underlying representation of data in memory is very different. Even if you stored just numeric values in field ``a``, the fact that the memory -representation of a ``Uint8`` differs from a ``Float64`` also means +representation of a ``UInt8`` differs from a ``Float64`` also means that the CPU needs to handle them using two different kinds of instructions. Since the required information is not available in the type, such decisions have to be made at run-time. This slows diff --git a/doc/manual/integers-and-floating-point-numbers.rst b/doc/manual/integers-and-floating-point-numbers.rst index 0f83bc8d7855a..1d9b58d0b8a29 100644 --- a/doc/manual/integers-and-floating-point-numbers.rst +++ b/doc/manual/integers-and-floating-point-numbers.rst @@ -30,15 +30,15 @@ The following are Julia's primitive numeric types: Type Signed? Number of bits Smallest value Largest value ----------- ------- -------------- -------------- ------------------ ``Int8`` ✓ 8 -2^7 2^7 - 1 -``Uint8`` 8 0 2^8 - 1 +``UInt8`` 8 0 2^8 - 1 ``Int16`` ✓ 16 -2^15 2^15 - 1 -``Uint16`` 16 0 2^16 - 1 +``UInt16`` 16 0 2^16 - 1 ``Int32`` ✓ 32 -2^31 2^31 - 1 -``Uint32`` 32 0 2^32 - 1 +``UInt32`` 32 0 2^32 - 1 ``Int64`` ✓ 64 -2^63 2^63 - 1 -``Uint64`` 64 0 2^64 - 1 +``UInt64`` 64 0 2^64 - 1 ``Int128`` ✓ 128 -2^127 2^127 - 1 -``Uint128`` 128 0 2^128 - 1 +``UInt128`` 128 0 2^128 - 1 ``Bool`` N/A 8 ``false`` (0) ``true`` (1) =========== ======= ============== ============== ================== @@ -96,21 +96,21 @@ is 32-bit or 64-bit.:: julia> WORD_SIZE 64 -Julia also defines the types ``Int`` and ``Uint``, which are aliases for the +Julia also defines the types ``Int`` and ``UInt``, which are aliases for the system's signed and unsigned native integer types respectively.:: # 32-bit system: julia> Int Int32 - julia> Uint - Uint32 + julia> UInt + UInt32 # 64-bit system: julia> Int Int64 - julia> Uint - Uint64 + julia> UInt + UInt64 Larger integer literals that cannot be represented using only 32 bits but can be represented in 64 bits always create 64-bit integers, @@ -130,25 +130,25 @@ The size of the unsigned value is determined by the number of hex digits used: 0x01 julia> typeof(ans) - Uint8 + UInt8 julia> 0x123 0x0123 julia> typeof(ans) - Uint16 + UInt16 julia> 0x1234567 0x01234567 julia> typeof(ans) - Uint32 + UInt32 julia> 0x123456789abcdef 0x0123456789abcdef julia> typeof(ans) - Uint64 + UInt64 This behavior is based on the observation that when one uses unsigned hex literals for integer values, one typically is using them to @@ -167,13 +167,13 @@ Binary and octal literals are also supported: 0x02 julia> typeof(ans) - Uint8 + UInt8 julia> 0o10 0x08 julia> typeof(ans) - Uint8 + UInt8 The minimum and maximum representable values of primitive numeric types such as integers are given by the ``typemin`` and ``typemax`` functions: @@ -183,7 +183,7 @@ such as integers are given by the ``typemin`` and ``typemax`` functions: julia> (typemin(Int32), typemax(Int32)) (-2147483648,2147483647) - julia> for T in [Int8,Int16,Int32,Int64,Int128,Uint8,Uint16,Uint32,Uint64,Uint128] + julia> for T in [Int8,Int16,Int32,Int64,Int128,UInt8,UInt16,UInt32,UInt64,UInt128] println("$(lpad(T,7)): [$(typemin(T)),$(typemax(T))]") end Int8: [-128,127] @@ -191,11 +191,11 @@ such as integers are given by the ``typemin`` and ``typemax`` functions: Int32: [-2147483648,2147483647] Int64: [-9223372036854775808,9223372036854775807] Int128: [-170141183460469231731687303715884105728,170141183460469231731687303715884105727] - Uint8: [0,255] - Uint16: [0,65535] - Uint32: [0,4294967295] - Uint64: [0,18446744073709551615] - Uint128: [0,340282366920938463463374607431768211455] + UInt8: [0,255] + UInt16: [0,65535] + UInt32: [0,4294967295] + UInt64: [0,18446744073709551615] + UInt128: [0,340282366920938463463374607431768211455] The values returned by ``typemin`` and ``typemax`` are always of the given argument type. (The above expression uses several features we have @@ -231,7 +231,7 @@ in :ref:`man-arbitrary-precision-arithmetic` is recommended instead. To minimize the practical impact of this overflow, integer addition, subtraction, multiplication, and exponentiation operands are promoted -to ``Int`` or ``Uint`` from narrower integer types. (However, +to ``Int`` or ``UInt`` from narrower integer types. (However, divisions, remainders, and bitwise operations do not promote narrower types.) diff --git a/doc/manual/mathematical-operations.rst b/doc/manual/mathematical-operations.rst index 3b6c307b1fb75..57b77a5c11cc9 100644 --- a/doc/manual/mathematical-operations.rst +++ b/doc/manual/mathematical-operations.rst @@ -129,7 +129,7 @@ are:: .. doctest:: julia> x = 0x01; typeof(x) - Uint8 + UInt8 julia> x *= 2 #Same as x = x * 2 2 diff --git a/doc/manual/methods.rst b/doc/manual/methods.rst index 6514c649d70cb..9431f84c67e12 100644 --- a/doc/manual/methods.rst +++ b/doc/manual/methods.rst @@ -227,11 +227,11 @@ Julia language. Core operations typically have dozens of methods:: +(A::Union(DenseArray{Bool,N},SubArray{Bool,N,A<:DenseArray{T,N},I<:(Union(Range{Int64},Int64)...,)}),B::Union(DenseArray{Bool,N},SubArray{Bool,N,A<:DenseArray{T,N},I<:(Union(Range{Int64},Int64)...,)})) at array.jl:797 +{S,T}(A::Union(SubArray{S,N,A<:DenseArray{T,N},I<:(Union(Range{Int64},Int64)...,)},DenseArray{S,N}),B::Union(SubArray{T,N,A<:DenseArray{T,N},I<:(Union(Range{Int64},Int64)...,)},DenseArray{T,N})) at array.jl:719 +{T<:Union(Int16,Int32,Int8)}(x::T<:Union(Int16,Int32,Int8),y::T<:Union(Int16,Int32,Int8)) at int.jl:16 - +{T<:Union(Uint32,Uint16,Uint8)}(x::T<:Union(Uint32,Uint16,Uint8),y::T<:Union(Uint32,Uint16,Uint8)) at int.jl:20 + +{T<:Union(UInt32,UInt16,UInt8)}(x::T<:Union(UInt32,UInt16,UInt8),y::T<:Union(UInt32,UInt16,UInt8)) at int.jl:20 +(x::Int64,y::Int64) at int.jl:33 - +(x::Uint64,y::Uint64) at int.jl:34 + +(x::UInt64,y::UInt64) at int.jl:34 +(x::Int128,y::Int128) at int.jl:35 - +(x::Uint128,y::Uint128) at int.jl:36 + +(x::UInt128,y::UInt128) at int.jl:36 +(x::Float32,y::Float32) at float.jl:119 +(x::Float64,y::Float64) at float.jl:120 +(z::Complex{T<:Real},w::Complex{T<:Real}) at complex.jl:110 @@ -246,16 +246,16 @@ Julia language. Core operations typically have dozens of methods:: +(a::BigInt,b::BigInt,c::BigInt) at gmp.jl:217 +(a::BigInt,b::BigInt,c::BigInt,d::BigInt) at gmp.jl:223 +(a::BigInt,b::BigInt,c::BigInt,d::BigInt,e::BigInt) at gmp.jl:230 - +(x::BigInt,c::Uint64) at gmp.jl:242 - +(c::Uint64,x::BigInt) at gmp.jl:246 - +(c::Union(Uint32,Uint16,Uint8,Uint64),x::BigInt) at gmp.jl:247 - +(x::BigInt,c::Union(Uint32,Uint16,Uint8,Uint64)) at gmp.jl:248 + +(x::BigInt,c::UInt64) at gmp.jl:242 + +(c::UInt64,x::BigInt) at gmp.jl:246 + +(c::Union(UInt32,UInt16,UInt8,UInt64),x::BigInt) at gmp.jl:247 + +(x::BigInt,c::Union(UInt32,UInt16,UInt8,UInt64)) at gmp.jl:248 +(x::BigInt,c::Union(Int64,Int16,Int32,Int8)) at gmp.jl:249 +(c::Union(Int64,Int16,Int32,Int8),x::BigInt) at gmp.jl:250 - +(x::BigFloat,c::Uint64) at mpfr.jl:147 - +(c::Uint64,x::BigFloat) at mpfr.jl:151 - +(c::Union(Uint32,Uint16,Uint8,Uint64),x::BigFloat) at mpfr.jl:152 - +(x::BigFloat,c::Union(Uint32,Uint16,Uint8,Uint64)) at mpfr.jl:153 + +(x::BigFloat,c::UInt64) at mpfr.jl:147 + +(c::UInt64,x::BigFloat) at mpfr.jl:151 + +(c::Union(UInt32,UInt16,UInt8,UInt64),x::BigFloat) at mpfr.jl:152 + +(x::BigFloat,c::Union(UInt32,UInt16,UInt8,UInt64)) at mpfr.jl:153 +(x::BigFloat,c::Int64) at mpfr.jl:157 +(c::Int64,x::BigFloat) at mpfr.jl:161 +(x::BigFloat,c::Union(Int64,Int16,Int32,Int8)) at mpfr.jl:162 diff --git a/doc/manual/networking-and-streams.rst b/doc/manual/networking-and-streams.rst index 434b2137dcd7e..ec3bc5e499fad 100644 --- a/doc/manual/networking-and-streams.rst +++ b/doc/manual/networking-and-streams.rst @@ -27,8 +27,8 @@ Note that I pressed enter again so that Julia would read the newline. Now, as yo `write` method takes the data to write as its second argument, while the read method takes the type of the data to be read as the second argument. For example, to read a simple byte array, we could do:: - julia> x = zeros(Uint8,4) - 4-element Array{Uint8,1}: + julia> x = zeros(UInt8,4) + 4-element Array{UInt8,1}: 0x00 0x00 0x00 @@ -36,7 +36,7 @@ data to be read as the second argument. For example, to read a simple byte array julia> read(STDIN,x) abcd - 4-element Array{Uint8,1}: + 4-element Array{UInt8,1}: 0x61 0x62 0x63 @@ -47,7 +47,7 @@ above as:: julia> readbytes(STDIN,4) abcd - 4-element Array{Uint8,1}: + 4-element Array{UInt8,1}: 0x61 0x62 0x63 diff --git a/doc/manual/strings.rst b/doc/manual/strings.rst index b7d6c04fca3b3..7439e315df7c7 100644 --- a/doc/manual/strings.rst +++ b/doc/manual/strings.rst @@ -727,7 +727,7 @@ Byte Array Literals Another useful non-standard string literal is the byte-array string literal: ``b"..."``. This form lets you use string notation to express -literal byte arrays — i.e. arrays of ``Uint8`` values. The convention is +literal byte arrays — i.e. arrays of ``UInt8`` values. The convention is that non-standard literals with uppercase prefixes produce actual string objects, while those with lowercase prefixes produce non-string objects like byte arrays or compiled regular expressions. The rules for byte @@ -749,7 +749,7 @@ three: .. doctest:: julia> b"DATA\xff\u2200" - 8-element Array{Uint8,1}: + 8-element Array{UInt8,1}: 0x44 0x41 0x54 @@ -779,11 +779,11 @@ bytes in UTF-8: .. doctest:: julia> b"\xff" - 1-element Array{Uint8,1}: + 1-element Array{UInt8,1}: 0xff julia> b"\uff" - 2-element Array{Uint8,1}: + 2-element Array{UInt8,1}: 0xc3 0xbf diff --git a/doc/manual/style-guide.rst b/doc/manual/style-guide.rst index 1a678d4babbac..b67f2d45716c7 100644 --- a/doc/manual/style-guide.rst +++ b/doc/manual/style-guide.rst @@ -244,7 +244,7 @@ Don't expose unsafe operations at the interface level If you have a type that uses a native pointer:: type NativeType - p::Ptr{Uint8} + p::Ptr{UInt8} ... end diff --git a/doc/manual/types.rst b/doc/manual/types.rst index 6103c6a0768ec..224894e4cf163 100644 --- a/doc/manual/types.rst +++ b/doc/manual/types.rst @@ -163,12 +163,12 @@ type system more than just a collection of object implementations. Recall that in :ref:`man-integers-and-floating-point-numbers`, we introduced a variety of concrete types of numeric values: ``Int8``, -``Uint8``, ``Int16``, ``Uint16``, ``Int32``, ``Uint32``, ``Int64``, -``Uint64``, ``Int128``, ``Uint128``, ``Float16``, ``Float32``, and +``UInt8``, ``Int16``, ``UInt16``, ``Int32``, ``UInt32``, ``Int64``, +``UInt64``, ``Int128``, ``UInt128``, ``Float16``, ``Float32``, and ``Float64``. Although they have different representation sizes, ``Int8``, ``Int16``, ``Int32``, ``Int64`` and ``Int128`` all have in common that -they are signed integer types. Likewise ``Uint8``, ``Uint16``, ``Uint32``, -``Uint64`` and ``Uint128`` are all unsigned integer types, while +they are signed integer types. Likewise ``UInt8``, ``UInt16``, ``UInt32``, +``UInt64`` and ``UInt128`` are all unsigned integer types, while ``Float16``, ``Float32`` and ``Float64`` are distinct in being floating-point types rather than integers. It is common for a piece of code to make sense, for example, only if its arguments are some kind of integer, @@ -287,15 +287,15 @@ the standard bits types are all defined in the language itself:: bitstype 32 Char bitstype 8 Int8 <: Signed - bitstype 8 Uint8 <: Unsigned + bitstype 8 UInt8 <: Unsigned bitstype 16 Int16 <: Signed - bitstype 16 Uint16 <: Unsigned + bitstype 16 UInt16 <: Unsigned bitstype 32 Int32 <: Signed - bitstype 32 Uint32 <: Unsigned + bitstype 32 UInt32 <: Unsigned bitstype 64 Int64 <: Signed - bitstype 64 Uint64 <: Unsigned + bitstype 64 UInt64 <: Unsigned bitstype 128 Int128 <: Signed - bitstype 128 Uint128 <: Unsigned + bitstype 128 UInt128 <: Unsigned The general syntaxes for declaration of a ``bitstype`` are:: @@ -312,18 +312,18 @@ Currently, only sizes that are multiples of 8 bits are supported. Therefore, boolean values, although they really need just a single bit, cannot be declared to be any smaller than eight bits. -The types ``Bool``, ``Int8`` and ``Uint8`` all have identical +The types ``Bool``, ``Int8`` and ``UInt8`` all have identical representations: they are eight-bit chunks of memory. Since Julia's type system is nominative, however, they are not interchangeable despite having identical structure. Another fundamental difference between them is that they have different supertypes: ``Bool``'s direct supertype is -``Integer``, ``Int8``'s is ``Signed``, and ``Uint8``'s is ``Unsigned``. -All other differences between ``Bool``, ``Int8``, and ``Uint8`` are +``Integer``, ``Int8``'s is ``Signed``, and ``UInt8``'s is ``Unsigned``. +All other differences between ``Bool``, ``Int8``, and ``UInt8`` are matters of behavior — the way functions are defined to act when given objects of these types as arguments. This is why a nominative type system is necessary: if structure determined type, which in turn dictates behavior, then it would be impossible to make ``Bool`` behave any -differently than ``Int8`` or ``Uint8``. +differently than ``Int8`` or ``UInt8``. .. _man-composite-types: @@ -1077,23 +1077,23 @@ Type Aliases Sometimes it is convenient to introduce a new name for an already expressible type. For such occasions, Julia provides the ``typealias`` -mechanism. For example, ``Uint`` is type aliased to either ``Uint32`` or -``Uint64`` as is appropriate for the size of pointers on the system:: +mechanism. For example, ``UInt`` is type aliased to either ``UInt32`` or +``UInt64`` as is appropriate for the size of pointers on the system:: # 32-bit system: - julia> Uint - Uint32 + julia> UInt + UInt32 # 64-bit system: - julia> Uint - Uint64 + julia> UInt + UInt64 This is accomplished via the following code in ``base/boot.jl``:: if is(Int,Int64) - typealias Uint Uint64 + typealias UInt UInt64 else - typealias Uint Uint32 + typealias UInt UInt32 end Of course, this depends on what ``Int`` is aliased to — but that is diff --git a/doc/stdlib/base.rst b/doc/stdlib/base.rst index 455a21633a0ae..c9d901b53ce3f 100644 --- a/doc/stdlib/base.rst +++ b/doc/stdlib/base.rst @@ -382,13 +382,13 @@ Types julia> structinfo(StatStruct) 12-element Array{(Int64,Symbol,DataType),1}: - (0,:device,Uint64) - (8,:inode,Uint64) - (16,:mode,Uint64) + (0,:device,UInt64) + (8,:inode,UInt64) + (16,:mode,UInt64) (24,:nlink,Int64) - (32,:uid,Uint64) - (40,:gid,Uint64) - (48,:rdev,Uint64) + (32,:uid,UInt64) + (40,:gid,UInt64) + (48,:rdev,UInt64) (56,:size,Int64) (64,:blksize,Int64) (72,:blocks,Int64) @@ -405,7 +405,7 @@ Types .. function:: isbits(T) - True if ``T`` is a "plain data" type, meaning it is immutable and contains no references to other values. Typical examples are numeric types such as ``Uint8``, ``Float64``, and ``Complex{Float64}``. + True if ``T`` is a "plain data" type, meaning it is immutable and contains no references to other values. Typical examples are numeric types such as ``UInt8``, ``Float64``, and ``Complex{Float64}``. .. doctest:: @@ -1268,7 +1268,7 @@ Strings Create a string from any value using the ``showall`` function. -.. function:: bytestring(::Ptr{Uint8}, [length]) +.. function:: bytestring(::Ptr{UInt8}, [length]) Create a string from the address of a C (0-terminated) string encoded in ASCII or UTF-8. A copy is made; the ptr can be safely freed. If ``length`` is specified, the string does not have to be 0-terminated. @@ -1276,7 +1276,7 @@ Strings Convert a string to a contiguous byte array representation appropriate for passing it to C functions. The string will be encoded as either ASCII or UTF-8. -.. function:: ascii(::Array{Uint8,1}) +.. function:: ascii(::Array{UInt8,1}) Create an ASCII string from a byte array. @@ -1284,7 +1284,7 @@ Strings Convert a string to a contiguous ASCII string (all characters must be valid ASCII characters). -.. function:: utf8(::Array{Uint8,1}) +.. function:: utf8(::Array{UInt8,1}) Create a UTF-8 string from a byte array. @@ -1567,7 +1567,7 @@ Strings .. function:: utf16(s) - Create a UTF-16 string from a byte array, array of ``Uint16``, or + Create a UTF-16 string from a byte array, array of ``UInt16``, or any other string type. (Data must be valid UTF-16. Conversions of byte arrays check for a byte-order marker in the first two bytes, and do not include it in the resulting string.) @@ -1577,23 +1577,23 @@ Strings string (so that it is mostly invisible in Julia); this allows the string to be passed directly to external functions requiring NUL-terminated data. This NUL is appended automatically by the - `utf16(s)` conversion function. If you have a ``Uint16`` array + `utf16(s)` conversion function. If you have a ``UInt16`` array ``A`` that is already NUL-terminated valid UTF-16 data, then you can instead use `UTF16String(A)`` to construct the string without making a copy of the data and treating the NUL as a terminator rather than as part of the string. -.. function:: utf16(::Union(Ptr{Uint16},Ptr{Int16}) [, length]) +.. function:: utf16(::Union(Ptr{UInt16},Ptr{Int16}) [, length]) Create a string from the address of a NUL-terminated UTF-16 string. A copy is made; the pointer can be safely freed. If ``length`` is specified, the string does not have to be NUL-terminated. .. function:: is_valid_utf16(s) -> Bool - Returns true if the argument (``UTF16String`` or ``Uint16`` array) is valid UTF-16. + Returns true if the argument (``UTF16String`` or ``UInt16`` array) is valid UTF-16. .. function:: utf32(s) - Create a UTF-32 string from a byte array, array of ``Uint32``, or + Create a UTF-32 string from a byte array, array of ``UInt32``, or any other string type. (Conversions of byte arrays check for a byte-order marker in the first four bytes, and do not include it in the resulting string.) @@ -1603,13 +1603,13 @@ Strings string (so that it is mostly invisible in Julia); this allows the string to be passed directly to external functions requiring NUL-terminated data. This NUL is appended automatically by the - `utf32(s)` conversion function. If you have a ``Uint32`` array + `utf32(s)` conversion function. If you have a ``UInt32`` array ``A`` that is already NUL-terminated UTF-32 data, then you can instead use `UTF32String(A)`` to construct the string without making a copy of the data and treating the NUL as a terminator rather than as part of the string. -.. function:: utf32(::Union(Ptr{Char},Ptr{Uint32},Ptr{Int32}) [, length]) +.. function:: utf32(::Union(Ptr{Char},Ptr{UInt32},Ptr{Int32}) [, length]) Create a string from the address of a NUL-terminated UTF-32 string. A copy is made; the pointer can be safely freed. If ``length`` is specified, the string does not have to be NUL-terminated. @@ -1718,7 +1718,7 @@ I/O Read binary data from a stream, filling in the argument ``array``. -.. function:: readbytes!(stream, b::Vector{Uint8}, nb=length(b)) +.. function:: readbytes!(stream, b::Vector{UInt8}, nb=length(b)) Read at most ``nb`` bytes from the stream into ``b``, returning the number of bytes read (increasing the size of ``b`` as needed). @@ -1726,7 +1726,7 @@ I/O .. function:: readbytes(stream, nb=typemax(Int)) Read at most ``nb`` bytes from the stream, returning a - ``Vector{Uint8}`` of the bytes read. + ``Vector{UInt8}`` of the bytes read. .. function:: position(s) @@ -1899,7 +1899,7 @@ I/O An IOBuffer that allows reading and performs writes by appending. Seeking and truncating are not supported. See IOBuffer for the available constructors. -.. function:: PipeBuffer(data::Vector{Uint8},[maxsize]) +.. function:: PipeBuffer(data::Vector{UInt8},[maxsize]) Create a PipeBuffer to operate on a data vector, optionally specifying a size beyond which the underlying Array may not be grown. @@ -2038,7 +2038,7 @@ Network I/O Accepts a connection on the given server and returns a connection to the client. An uninitialized client stream may be provided, in which case it will be used instead of creating a new stream. -.. function:: listenany(port_hint) -> (Uint16,TcpServer) +.. function:: listenany(port_hint) -> (UInt16,TcpServer) Create a TcpServer on any port, using hint as a starting point. Returns a tuple of the actual port that the server was created on and the server itself. @@ -2268,7 +2268,7 @@ Julia environments (such as the IPython-based IJulia notebook). is not supported by either the display(s) or by ``x``. With these variants, one can also supply the "raw" data in the requested MIME type by passing ``x::AbstractString`` (for MIME types with text-based storage, - such as text/html or application/postscript) or ``x::Vector{Uint8}`` + such as text/html or application/postscript) or ``x::Vector{UInt8}`` (for binary MIME types). .. function:: redisplay(x) @@ -2325,17 +2325,17 @@ Julia environments (such as the IPython-based IJulia notebook). .. function:: reprmime(mime, x) - Returns a ``AbstractString`` or ``Vector{Uint8}`` containing the + Returns a ``AbstractString`` or ``Vector{UInt8}`` containing the representation of ``x`` in the requested ``mime`` type, as written by ``writemime`` (throwing a ``MethodError`` if no appropriate ``writemime`` is available). A ``AbstractString`` is returned for MIME types with textual representations (such as ``"text/html"`` or ``"application/postscript"``), whereas binary data is returned as - ``Vector{Uint8}``. (The function ``istext(mime)`` returns whether + ``Vector{UInt8}``. (The function ``istext(mime)`` returns whether or not Julia treats a given ``mime`` type as text.) As a special case, if ``x`` is a ``AbstractString`` (for textual MIME types) - or a ``Vector{Uint8}`` (for binary MIME types), the ``reprmime`` function + or a ``Vector{UInt8}`` (for binary MIME types), the ``reprmime`` function assumes that ``x`` is already in the requested ``mime`` format and simply returns ``x``. @@ -2474,7 +2474,7 @@ Memory-mapped I/O Standard Numeric Types ---------------------- -``Bool`` ``Int8`` ``Uint8`` ``Int16`` ``Uint16`` ``Int32`` ``Uint32`` ``Int64`` ``Uint64`` ``Int128`` ``Uint128`` ``Float16`` ``Float32`` ``Float64`` ``Complex64`` ``Complex128`` +``Bool`` ``Int8`` ``UInt8`` ``Int16`` ``UInt16`` ``Int32`` ``UInt32`` ``Int64`` ``UInt64`` ``Int128`` ``UInt128`` ``Float16`` ``Float32`` ``Float64`` ``Complex64`` ``Complex128`` .. _mathematical-operators: @@ -3526,7 +3526,7 @@ Data Formats .. function:: base(base, n, [pad]) - Convert an integer to a string in the given base, optionally specifying a number of digits to pad to. The base can be specified as either an integer, or as a ``Uint8`` array of character values to use as digit symbols. + Convert an integer to a string in the given base, optionally specifying a number of digits to pad to. The base can be specified as either an integer, or as a ``UInt8`` array of character values to use as digit symbols. .. function:: digits(n, [base], [pad]) @@ -3602,23 +3602,23 @@ Data Formats .. function:: uint8(x) - Convert a number or array to ``Uint8`` data type + Convert a number or array to ``UInt8`` data type .. function:: uint16(x) - Convert a number or array to ``Uint16`` data type + Convert a number or array to ``UInt16`` data type .. function:: uint32(x) - Convert a number or array to ``Uint32`` data type + Convert a number or array to ``UInt32`` data type .. function:: uint64(x) - Convert a number or array to ``Uint64`` data type + Convert a number or array to ``UInt64`` data type .. function:: uint128(x) - Convert a number or array to ``Uint128`` data type + Convert a number or array to ``UInt128`` data type .. function:: float16(x) @@ -3692,9 +3692,9 @@ Data Formats .. function:: hex2bytes(s::ASCIIString) - Convert an arbitrarily long hexadecimal string to its binary representation. Returns an Array{Uint8, 1}, i.e. an array of bytes. + Convert an arbitrarily long hexadecimal string to its binary representation. Returns an Array{UInt8, 1}, i.e. an array of bytes. -.. function:: bytes2hex(bin_arr::Array{Uint8, 1}) +.. function:: bytes2hex(bin_arr::Array{UInt8, 1}) Convert an array of bytes to its hexadecimal representation. All characters are in lower-case. Returns an ASCIIString. @@ -3993,11 +3993,11 @@ Random number generation in Julia uses the `Mersenne Twister library [x>>4; x&0x0F], reinterpret(Uint8, [int32(i)]))...)) +get_str(i) = ascii(vcat(map(x->[x>>4; x&0x0F], reinterpret(UInt8, [int32(i)]))...)) isbounded{L<:LRUExample.LRU}(::Type{L}) = any(map(n->n==:maxsize, L.names)) isbounded{L<:LRUExample.LRU}(l::L) = isbounded(L) diff --git a/examples/plife.jl b/examples/plife.jl index 59f1df89a5168..cec55249da65d 100644 --- a/examples/plife.jl +++ b/examples/plife.jl @@ -53,7 +53,7 @@ function plife(m, n) last = time(); f = 1 while !done @async begin - img = convert(Array{Uint32,2},grid) .* 0x00ffffff + img = convert(Array{UInt32,2},grid) .* 0x00ffffff set_source_surface(cr, CairoRGBSurface(img), 0, 0) paint(cr) reveal(c) diff --git a/examples/typetree.jl b/examples/typetree.jl index ae5443945867a..a2d5e7fc531b1 100644 --- a/examples/typetree.jl +++ b/examples/typetree.jl @@ -119,4 +119,4 @@ end # print_tree(types_tree) -end # module \ No newline at end of file +end # module diff --git a/src/file_constants.h b/src/file_constants.h index 97de44d9e3bf4..db1c43cb77515 100644 --- a/src/file_constants.h +++ b/src/file_constants.h @@ -23,4 +23,4 @@ const JL_O_RANDOM = O_RANDOM #endif #ifdef O_NOCTTY const JL_O_NOCTTY = O_NOCTTY -#endif \ No newline at end of file +#endif diff --git a/src/init.c b/src/init.c index 44e0cdd58e0bf..852dc878a4750 100644 --- a/src/init.c +++ b/src/init.c @@ -1080,11 +1080,11 @@ void jl_get_builtin_hooks(void) jl_char_type = (jl_datatype_t*)core("Char"); jl_int8_type = (jl_datatype_t*)core("Int8"); - jl_uint8_type = (jl_datatype_t*)core("Uint8"); + jl_uint8_type = (jl_datatype_t*)core("UInt8"); jl_int16_type = (jl_datatype_t*)core("Int16"); - jl_uint16_type = (jl_datatype_t*)core("Uint16"); - jl_uint32_type = (jl_datatype_t*)core("Uint32"); - jl_uint64_type = (jl_datatype_t*)core("Uint64"); + jl_uint16_type = (jl_datatype_t*)core("UInt16"); + jl_uint32_type = (jl_datatype_t*)core("UInt32"); + jl_uint64_type = (jl_datatype_t*)core("UInt64"); jl_float32_type = (jl_datatype_t*)core("Float32"); jl_float64_type = (jl_datatype_t*)core("Float64"); diff --git a/src/julia-parser.scm b/src/julia-parser.scm index ff99e686d3386..88b472015f16a 100644 --- a/src/julia-parser.scm +++ b/src/julia-parser.scm @@ -310,7 +310,7 @@ (string.sub s 1) s) r is-float32-literal))) - ;; n is #f for integers > typemax(Uint64) + ;; n is #f for integers > typemax(UInt64) (cond (is-hex-float-literal (double n)) ((eq? pred char-hex?) (fix-uint-neg neg (sized-uint-literal n s 4))) ((eq? pred char-oct?) (fix-uint-neg neg (sized-uint-oct-literal n s))) diff --git a/test/arrayops.jl b/test/arrayops.jl index 7aede5b07b403..143f7688655e0 100644 --- a/test/arrayops.jl +++ b/test/arrayops.jl @@ -107,7 +107,7 @@ b = [4, 6, 2, -7, 1] ind = findin(a, b) @test ind == [3,4] -rt = Base.return_types(setindex!, (Array{Int32, 3}, Uint8, Vector{Int}, Float64, Range1{Int})) +rt = Base.return_types(setindex!, (Array{Int32, 3}, UInt8, Vector{Int}, Float64, Range1{Int})) @test length(rt) == 1 && rt[1] == Array{Int32, 3} # sub @@ -390,7 +390,7 @@ D = cat(3, B, B) immutable HashCollision x::Float64 end -Base.hash(::HashCollision, h::Uint) = h +Base.hash(::HashCollision, h::UInt) = h @test map(x->x.x, unique(map(HashCollision, B), 1)) == C ## large matrices transpose ## @@ -777,7 +777,7 @@ fill!(S, 2) S = sub(A, 1:2, 3) fill!(S, 3) @test A == [1 1 3; 2 2 3; 1 1 1] -rt = Base.return_types(fill!, (Array{Int32, 3}, Uint8)) +rt = Base.return_types(fill!, (Array{Int32, 3}, UInt8)) @test length(rt) == 1 && rt[1] == Array{Int32, 3} # splice! diff --git a/test/bigint.jl b/test/bigint.jl index 5dc4965324b47..8463edf174199 100644 --- a/test/bigint.jl +++ b/test/bigint.jl @@ -47,11 +47,11 @@ end @test typeof(BigInt(typemax(Int128))) == BigInt @test typeof(BigInt(true)) == BigInt -@test typeof(BigInt(typemax(Uint8))) == BigInt -@test typeof(BigInt(typemax(Uint16))) == BigInt -@test typeof(BigInt(typemax(Uint32))) == BigInt -@test typeof(BigInt(typemax(Uint64))) == BigInt -@test typeof(BigInt(typemax(Uint128))) == BigInt +@test typeof(BigInt(typemax(UInt8))) == BigInt +@test typeof(BigInt(typemax(UInt16))) == BigInt +@test typeof(BigInt(typemax(UInt32))) == BigInt +@test typeof(BigInt(typemax(UInt64))) == BigInt +@test typeof(BigInt(typemax(UInt128))) == BigInt @test typeof(BigInt(BigInt(1))) == BigInt diff --git a/test/bitarray.jl b/test/bitarray.jl index b30433cb0aaeb..354ef70d278d1 100644 --- a/test/bitarray.jl +++ b/test/bitarray.jl @@ -644,16 +644,16 @@ cf1 = complex(f1) @check_bit_operation (.-)(i1, b2) Matrix{Int} @check_bit_operation (.*)(i1, b2) Matrix{Int} -@check_bit_operation (&)(u1, b2) Matrix{Uint8} -@check_bit_operation (|)(u1, b2) Matrix{Uint8} -@check_bit_operation ($)(u1, b2) Matrix{Uint8} -@check_bit_operation (.+)(u1, b2) Matrix{Uint8} -@check_bit_operation (.-)(u1, b2) Matrix{Uint8} -@check_bit_operation (.*)(u1, b2) Matrix{Uint8} +@check_bit_operation (&)(u1, b2) Matrix{UInt8} +@check_bit_operation (|)(u1, b2) Matrix{UInt8} +@check_bit_operation ($)(u1, b2) Matrix{UInt8} +@check_bit_operation (.+)(u1, b2) Matrix{UInt8} +@check_bit_operation (.-)(u1, b2) Matrix{UInt8} +@check_bit_operation (.*)(u1, b2) Matrix{UInt8} for (x1,t1) = [(f1, Float64), (ci1, Complex{Int}), - (cu1, Complex{Uint8}), + (cu1, Complex{UInt8}), (cf1, Complex128)] @check_bit_operation (.+)(x1, b2) Matrix{t1} @check_bit_operation (.-)(x1, b2) Matrix{t1} @@ -673,8 +673,8 @@ b2 = trues(n1, n2) @check_bit_operation mod(i1, b2) Matrix{Int} @check_bit_operation (./)(u1, b2) Matrix{Float64} -@check_bit_operation div(u1, b2) Matrix{Uint8} -@check_bit_operation mod(u1, b2) Matrix{Uint8} +@check_bit_operation div(u1, b2) Matrix{UInt8} +@check_bit_operation mod(u1, b2) Matrix{UInt8} @check_bit_operation (./)(f1, b2) Matrix{Float64} @check_bit_operation div(f1, b2) Matrix{Float64} @@ -687,8 +687,8 @@ b2 = trues(n1, n2) b2 = randbool(n1, n2) @check_bit_operation (.^)(false, b2) BitMatrix @check_bit_operation (.^)(true, b2) BitMatrix -@check_bit_operation (.^)(0x0, b2) Matrix{Uint8} -@check_bit_operation (.^)(0x1, b2) Matrix{Uint8} +@check_bit_operation (.^)(0x0, b2) Matrix{UInt8} +@check_bit_operation (.^)(0x1, b2) Matrix{UInt8} @check_bit_operation (.^)(-1, b2) Matrix{Int} @check_bit_operation (.^)(0, b2) Matrix{Int} @check_bit_operation (.^)(1, b2) Matrix{Int} @@ -698,8 +698,8 @@ b2 = randbool(n1, n2) @check_bit_operation (.^)(1.0im, b2) Matrix{Complex128} @check_bit_operation (.^)(0im, b2) Matrix{Complex{Int}} @check_bit_operation (.^)(1im, b2) Matrix{Complex{Int}} -@check_bit_operation (.^)(0x0im, b2) Matrix{Complex{Uint8}} -@check_bit_operation (.^)(0x1im, b2) Matrix{Complex{Uint8}} +@check_bit_operation (.^)(0x0im, b2) Matrix{Complex{UInt8}} +@check_bit_operation (.^)(0x1im, b2) Matrix{Complex{UInt8}} # Matrix/Number b1 = randbool(n1, n2) @@ -737,15 +737,15 @@ cf2 = complex(f2) @check_bit_operation div(b1, i2) Matrix{Int} @check_bit_operation mod(b1, i2) Matrix{Int} -@check_bit_operation (&)(b1, u2) Matrix{Uint8} -@check_bit_operation (|)(b1, u2) Matrix{Uint8} -@check_bit_operation ($)(b1, u2) Matrix{Uint8} -@check_bit_operation (.+)(b1, u2) Matrix{Uint8} -@check_bit_operation (.-)(b1, u2) Matrix{Uint8} -@check_bit_operation (.*)(b1, u2) Matrix{Uint8} +@check_bit_operation (&)(b1, u2) Matrix{UInt8} +@check_bit_operation (|)(b1, u2) Matrix{UInt8} +@check_bit_operation ($)(b1, u2) Matrix{UInt8} +@check_bit_operation (.+)(b1, u2) Matrix{UInt8} +@check_bit_operation (.-)(b1, u2) Matrix{UInt8} +@check_bit_operation (.*)(b1, u2) Matrix{UInt8} @check_bit_operation (./)(b1, u2) Matrix{Float64} -@check_bit_operation div(b1, u2) Matrix{Uint8} -@check_bit_operation mod(b1, u2) Matrix{Uint8} +@check_bit_operation div(b1, u2) Matrix{UInt8} +@check_bit_operation mod(b1, u2) Matrix{UInt8} @check_bit_operation (.+)(b1, f2) Matrix{Float64} @check_bit_operation (.-)(b1, f2) Matrix{Float64} @@ -759,9 +759,9 @@ cf2 = complex(f2) @check_bit_operation (.*)(b1, ci2) Matrix{Complex{Int}} @check_bit_operation (./)(b1, ci2) Matrix{Complex128} -@check_bit_operation (.+)(b1, cu2) Matrix{Complex{Uint8}} -@check_bit_operation (.-)(b1, cu2) Matrix{Complex{Uint8}} -@check_bit_operation (.*)(b1, cu2) Matrix{Complex{Uint8}} +@check_bit_operation (.+)(b1, cu2) Matrix{Complex{UInt8}} +@check_bit_operation (.-)(b1, cu2) Matrix{Complex{UInt8}} +@check_bit_operation (.*)(b1, cu2) Matrix{Complex{UInt8}} @check_bit_operation (./)(b1, cu2) Matrix{Complex128} @check_bit_operation (.+)(b1, cf2) Matrix{Complex128} diff --git a/test/ccall.jl b/test/ccall.jl index 54c519cf7b716..25221003e0dcc 100644 --- a/test/ccall.jl +++ b/test/ccall.jl @@ -1,3 +1,3 @@ -ccall_test_func(x) = ccall((:testUcharX, "./libccalltest"), Int32, (Uint8,), x) +ccall_test_func(x) = ccall((:testUcharX, "./libccalltest"), Int32, (UInt8,), x) @test ccall_test_func(3) == 1 @test ccall_test_func(259) == 1 diff --git a/test/collections.jl b/test/collections.jl index 0b58601b23333..d4aef5b114cf5 100644 --- a/test/collections.jl +++ b/test/collections.jl @@ -114,7 +114,7 @@ type I1438T id end import Base.hash -hash(x::I1438T, h::Uint) = hash(x.id, h) +hash(x::I1438T, h::UInt) = hash(x.id, h) begin local seq, xs, s @@ -512,7 +512,7 @@ s = IntSet(0,1,10,20,200,300,1000,10000,10002) @test_throws ErrorException first(IntSet()) @test_throws ErrorException last(IntSet()) t = copy(s) -sizehint(t, 20000) #check that hash does not depend on size of internal Array{Uint32, 1} +sizehint(t, 20000) #check that hash does not depend on size of internal Array{UInt32, 1} @test hash(s) == hash(t) @test hash(complement(s)) == hash(complement(t)) diff --git a/test/core.jl b/test/core.jl index d7f2d27279592..1511138f2cee2 100644 --- a/test/core.jl +++ b/test/core.jl @@ -30,7 +30,7 @@ const Bottom = Union() @test !(Type{Rational{Int}} <: Type{Rational}) let T = TypeVar(:T,true) @test !is(Bottom, typeintersect(Array{Bottom},AbstractArray{T})) - @test is(Bottom, typeintersect((Type{Ptr{Uint8}},Ptr{Bottom}), + @test is(Bottom, typeintersect((Type{Ptr{UInt8}},Ptr{Bottom}), (Type{Ptr{T}},Ptr{T}))) @test !(Type{T} <: TypeVar) @@ -165,7 +165,7 @@ end (Int8,Signed...)) @test Base.typeseq(typejoin((Int8,Int...),(Int8,Int8...)), (Int8,Signed...)) -@test Base.typeseq(typejoin((Int8,Uint8,Int...),(Int8,Int8...)), +@test Base.typeseq(typejoin((Int8,UInt8,Int...),(Int8,Int8...)), (Int8,Integer...)) @test Base.typeseq(typejoin(Union(Int,AbstractString),Int), Union(Int,AbstractString)) @test Base.typeseq(typejoin(Union(Int,AbstractString),Int8), Any) @@ -1187,7 +1187,7 @@ f4526(x) = isa(x.a, Void) # issue #4528 function f4528(A, B) if A - reinterpret(Uint64, B) + reinterpret(UInt64, B) end end @test f4528(false, int32(12)) === nothing @@ -1235,7 +1235,7 @@ type Z4681 Z4681() = new(C_NULL) end Base.convert(::Type{Ptr{Z4681}},b::Z4681) = b.x -@test_throws TypeError ccall(:printf,Int,(Ptr{Uint8},Ptr{Z4681}),"",Z4681()) +@test_throws TypeError ccall(:printf,Int,(Ptr{UInt8},Ptr{Z4681}),"",Z4681()) # issue #4479 f4479(::Real,c) = 1 @@ -1435,7 +1435,7 @@ end function read_file5374(fileobj) read(fileobj.io, Float32) end -@test isa(read_file5374(FileObj5374(IOBuffer(Uint8[0,0,0,0]))), Float32) +@test isa(read_file5374(FileObj5374(IOBuffer(UInt8[0,0,0,0]))), Float32) # issue #5457 function f5457(obj_ptr::Ptr{Float64}, f) @@ -1658,7 +1658,7 @@ end # issue #6634 function crc6634(spec) - A = Uint + A = UInt remainder::A = 1 function handler(append) remainder = append ? 1 : 2 @@ -1783,7 +1783,7 @@ f7062{t,n}(::Type{Array{t,n}}, ::Array{t,n}) = (t,n,2) # issue #7302 function test7302() - t = [Uint64][1] + t = [UInt64][1] convert(t, "5") end @test_throws MethodError test7302() @@ -1843,11 +1843,11 @@ bar7810() = [Foo7810([(a,b) for a in 1:2]) for b in 3:4] # issue 7897 function issue7897!(data, arr) - data = reinterpret(Uint32, data) + data = reinterpret(UInt32, data) a = arr[1] end -a = ones(Uint8, 10) +a = ones(UInt8, 10) sa = sub(a,4:6) # This can throw an error, but shouldn't segfault try @@ -1914,10 +1914,10 @@ c99991{T}(::Type{UnitRange{T}},x::Range{T}) = 2 # issue #8798 let const npy_typestrs = Dict("b1"=>Bool, - "i1"=>Int8, "u1"=>Uint8, - "i2"=>Int16, "u2"=>Uint16, - "i4"=>Int32, "u4"=>Uint32, - "i8"=>Int64, "u8"=>Uint64) + "i1"=>Int8, "u1"=>UInt8, + "i2"=>Int16, "u2"=>UInt16, + "i4"=>Int32, "u4"=>UInt32, + "i8"=>Int64, "u8"=>UInt64) sizeof_lookup() = sizeof(npy_typestrs["i8"]) @test sizeof_lookup() == 8 end diff --git a/test/dates/periods.jl b/test/dates/periods.jl index 76403c1c659ec..a926e2738097f 100644 --- a/test/dates/periods.jl +++ b/test/dates/periods.jl @@ -36,15 +36,15 @@ ms = Dates.Millisecond(1) @test Dates.Second(s) == s @test Dates.Millisecond(ms) == ms @test typeof(int8(y)) <: Int8 -@test typeof(uint8(y)) <: Uint8 +@test typeof(uint8(y)) <: UInt8 @test typeof(int16(y)) <: Int16 -@test typeof(uint16(y)) <: Uint16 +@test typeof(uint16(y)) <: UInt16 @test typeof(int32(y)) <: Int32 -@test typeof(uint32(y)) <: Uint32 +@test typeof(uint32(y)) <: UInt32 @test typeof(int64(y)) <: Int64 -@test typeof(uint64(y)) <: Uint64 +@test typeof(uint64(y)) <: UInt64 @test typeof(int128(y)) <: Int128 -@test typeof(uint128(y)) <: Uint128 +@test typeof(uint128(y)) <: UInt128 @test typeof(convert(BigInt,y)) <: BigInt @test typeof(convert(BigFloat,y)) <: BigFloat @test typeof(convert(Complex,y)) <: Complex @@ -53,15 +53,15 @@ ms = Dates.Millisecond(1) @test typeof(float32(y)) <: Float32 @test typeof(float64(y)) <: Float64 @test Dates.Year(convert(Int8,1)) == y -@test Dates.Year(convert(Uint8,1)) == y +@test Dates.Year(convert(UInt8,1)) == y @test Dates.Year(convert(Int16,1)) == y -@test Dates.Year(convert(Uint16,1)) == y +@test Dates.Year(convert(UInt16,1)) == y @test Dates.Year(convert(Int32,1)) == y -@test Dates.Year(convert(Uint32,1)) == y +@test Dates.Year(convert(UInt32,1)) == y @test Dates.Year(convert(Int64,1)) == y -@test Dates.Year(convert(Uint64,1)) == y +@test Dates.Year(convert(UInt64,1)) == y @test Dates.Year(convert(Int128,1)) == y -@test Dates.Year(convert(Uint128,1)) == y +@test Dates.Year(convert(UInt128,1)) == y @test Dates.Year(convert(BigInt,1)) == y @test Dates.Year(convert(BigFloat,1)) == y @test Dates.Year(convert(Complex,1)) == y diff --git a/test/file.jl b/test/file.jl index c451785eab051..f887aee54278c 100644 --- a/test/file.jl +++ b/test/file.jl @@ -169,16 +169,16 @@ write(s, "Hello World\n") close(s) s = open(file, "r") @test isreadonly(s) == true -c = mmap_array(Uint8, (11,), s) +c = mmap_array(UInt8, (11,), s) @test c == "Hello World".data -c = mmap_array(Uint8, (uint16(11),), s) +c = mmap_array(UInt8, (uint16(11),), s) @test c == "Hello World".data -@test_throws ErrorException mmap_array(Uint8, (int16(-11),), s) -@test_throws ErrorException mmap_array(Uint8, (typemax(Uint),), s) +@test_throws ErrorException mmap_array(UInt8, (int16(-11),), s) +@test_throws ErrorException mmap_array(UInt8, (typemax(UInt),), s) close(s) s = open(file, "r+") @test isreadonly(s) == false -c = mmap_array(Uint8, (11,), s) +c = mmap_array(UInt8, (11,), s) c[5] = uint8('x') msync(c) close(s) @@ -323,7 +323,7 @@ write(f, "Hello, world!") close(f) f = open(file, "r") FILEp = convert(CFILE, f) -buf = Array(Uint8, 8) +buf = Array(UInt8, 8) str = ccall(:fread, Csize_t, (Ptr{Void}, Csize_t, Csize_t, Ptr{Void}), buf, 1, 8, FILEp.ptr) @test bytestring(buf) == "Hello, w" @test position(FILEp) == 8 diff --git a/test/grisu.jl b/test/grisu.jl index c1161b08641b8..567dcb75262fc 100644 --- a/test/grisu.jl +++ b/test/grisu.jl @@ -12,7 +12,7 @@ function trimrep(buffer) end const bufsize = 500 -buffer = Array(Uint8,bufsize); +buffer = Array(UInt8,bufsize); fill!(buffer,0); # Start by checking the byte-order. diff --git a/test/hashing.jl b/test/hashing.jl index ce316551b754f..eeb936e64f079 100644 --- a/test/hashing.jl +++ b/test/hashing.jl @@ -1,8 +1,8 @@ types = Any[ Bool, - Int8, Uint8, Int16, Uint16, Int32, Uint32, Int64, Uint64, Float32, Float64, - Rational{Int8}, Rational{Uint8}, Rational{Int16}, Rational{Uint16}, - Rational{Int32}, Rational{Uint32}, Rational{Int64}, Rational{Uint64} + Int8, UInt8, Int16, UInt16, Int32, UInt32, Int64, UInt64, Float32, Float64, + Rational{Int8}, Rational{UInt8}, Rational{Int16}, Rational{UInt16}, + Rational{Int32}, Rational{UInt32}, Rational{Int64}, Rational{UInt64} ] vals = [ typemin(Int64), diff --git a/test/iobuffer.jl b/test/iobuffer.jl index 678b44175f336..6bb32ba1c1cbe 100644 --- a/test/iobuffer.jl +++ b/test/iobuffer.jl @@ -2,16 +2,16 @@ ioslength(io::IOBuffer) = (io.seekable ? io.size : nb_available(io)) let io = IOBuffer() @test eof(io) -@test_throws EOFError read(io,Uint8) +@test_throws EOFError read(io,UInt8) @test write(io,"abc") == 3 @test ioslength(io) == 3 @test position(io) == 3 @test eof(io) seek(io, 0) -@test read(io,Uint8) == convert(Uint8, 'a') -a = Array(Uint8, 2) +@test read(io,UInt8) == convert(UInt8, 'a') +a = Array(UInt8, 2) @test read!(io, a) == a -@test a == Uint8['b','c'] +@test a == UInt8['b','c'] @test bytestring(io) == "abc" seek(io, 1) truncate(io, 2) @@ -29,13 +29,13 @@ seek(io, 2) truncate(io, 10) @test ioslength(io) == 10 io.readable = false -@test_throws ErrorException read!(io,Uint8[0]) +@test_throws ErrorException read!(io,UInt8[0]) truncate(io, 0) @test write(io,"boston\ncambridge\n") > 0 @test takebuf_string(io) == "boston\ncambridge\n" @test takebuf_string(io) == "" close(io) -@test_throws ErrorException write(io,Uint8[0]) +@test_throws ErrorException write(io,UInt8[0]) @test_throws ErrorException seek(io,0) @test eof(io) end @@ -44,19 +44,19 @@ let io = IOBuffer("hamster\nguinea pig\nturtle") @test position(io) == 0 @test readline(io) == "hamster\n" @test readall(io) == "guinea pig\nturtle" -@test_throws EOFError read(io,Uint8) +@test_throws EOFError read(io,UInt8) seek(io,0) -@test read(io,Uint8) == convert(Uint8, 'h') +@test read(io,UInt8) == convert(UInt8, 'h') @test_throws ErrorException truncate(io,0) @test_throws ErrorException write(io,uint8(0)) -@test_throws ErrorException write(io,Uint8[0]) +@test_throws ErrorException write(io,UInt8[0]) @test takebuf_string(io) == "hamster\nguinea pig\nturtle" @test takebuf_string(io) == "hamster\nguinea pig\nturtle" #should be unchanged close(io) end let io = PipeBuffer() -@test_throws EOFError read(io,Uint8) +@test_throws EOFError read(io,UInt8) @test write(io,"pancakes\nwaffles\nblueberries\n") > 0 @test position(io) == 0 @test readline(io) == "pancakes\n" @@ -84,7 +84,7 @@ Base.ensureroom(io,100) seekend(io) @test ioslength(io) == 0 @test position(io) == 0 -write(io,zeros(Uint8,200)) +write(io,zeros(UInt8,200)) @test ioslength(io) == 75 @test length(io.data) == 75 write(io,1) @@ -101,7 +101,7 @@ skip(io,71) @test write(io,'y') == 1 @test readall(io) == "happy" @test eof(io) -write(io,zeros(Uint8,73)) +write(io,zeros(UInt8,73)) write(io,'a') write(io,'b') write(io,'c') @@ -121,7 +121,7 @@ end # issue 5453 let io=IOBuffer("abcdef") -a = Array(Uint8,1024) +a = Array(UInt8,1024) @test_throws EOFError read!(io,a) @test eof(io) end diff --git a/test/math.jl b/test/math.jl index b9ac1ff5404c8..286190fdae4dd 100644 --- a/test/math.jl +++ b/test/math.jl @@ -270,8 +270,8 @@ end @test_approx_eq quadgk(cos, 0,0.7,1, norm=abs)[1] sin(1) # Ensure subnormal flags functions don't segfault -@test any(ccall("jl_zero_subnormals", Uint8, (Uint8,), 1) .== [0x00 0x01]) -@test any(ccall("jl_zero_subnormals", Uint8, (Uint8,), 0) .== [0x00 0x01]) +@test any(ccall("jl_zero_subnormals", UInt8, (UInt8,), 1) .== [0x00 0x01]) +@test any(ccall("jl_zero_subnormals", UInt8, (UInt8,), 0) .== [0x00 0x01]) # isqrt (issue #4884) @test isqrt(9223372030926249000) == 3037000498 @@ -279,11 +279,11 @@ end @test isqrt(int128(typemax(Int64))^2-1) == 9223372036854775806 @test isqrt(0) == 0 for i = 1:1000 - n = rand(Uint128) + n = rand(UInt128) s = isqrt(n) @test s*s <= n @test (s+1)*(s+1) > n - n = rand(Uint64) + n = rand(UInt64) s = isqrt(n) @test s*s <= n @test (s+1)*(s+1) > n diff --git a/test/mpfr.jl b/test/mpfr.jl index 0f68f654e6666..059d97b008e4d 100644 --- a/test/mpfr.jl +++ b/test/mpfr.jl @@ -26,14 +26,14 @@ y = BigFloat(12//1) x = BigFloat(12) y = BigFloat(30) @test x + y == BigFloat(42) -@test x + typemax(Uint128) == x + BigInt(typemax(Uint128)) +@test x + typemax(UInt128) == x + BigInt(typemax(UInt128)) @test x + typemax(Int128) == x + BigInt(typemax(Int128)) # - x = BigFloat(12) y = BigFloat(-30) @test x - y == BigFloat(42) -@test x - typemax(Uint128) == x - BigInt(typemax(Uint128)) +@test x - typemax(UInt128) == x - BigInt(typemax(UInt128)) @test x - typemax(Int128) == x - BigInt(typemax(Int128)) # * @@ -41,14 +41,14 @@ x = BigFloat(6) y = BigFloat(9) @test x * y != BigFloat(42) @test x * y == BigFloat(54) -@test x * typemax(Uint128) == x * BigInt(typemax(Uint128)) +@test x * typemax(UInt128) == x * BigInt(typemax(UInt128)) @test x * typemax(Int128) == x * BigInt(typemax(Int128)) # / x = BigFloat(9) y = BigFloat(6) @test x / y == BigFloat(9/6) -@test x / typemax(Uint128) == x / BigInt(typemax(Uint128)) +@test x / typemax(UInt128) == x / BigInt(typemax(UInt128)) @test x / typemax(Int128) == x / BigInt(typemax(Int128)) # iterated arithmetic @@ -337,13 +337,13 @@ y = BigFloat(42) @test_throws InexactError convert(Int32, x) @test_throws InexactError convert(Int64, x) @test_throws InexactError convert(BigInt, x) -@test_throws InexactError convert(Uint32, x) -@test_throws InexactError convert(Uint32, x) +@test_throws InexactError convert(UInt32, x) +@test_throws InexactError convert(UInt32, x) @test convert(Int32, y) == 42 @test convert(Int64, y) == 42 @test convert(BigInt, y) == 42 -@test convert(Uint32, y) == 42 -@test convert(Uint32, y) == 42 +@test convert(UInt32, y) == 42 +@test convert(UInt32, y) == 42 # iround x = BigFloat(42.42) @@ -353,13 +353,13 @@ end z = BigInt("9223372036854775809") @test iround(x) == 42 @test iround(y) == z -@test typeof(iround(Uint8, x)) == Uint8 && iround(Uint8, x) == 0x2a -@test typeof(iround(Uint16, x)) == Uint16 && iround(Uint16, x) == 0x2a -@test typeof(iround(Uint32, x)) == Uint32 && iround(Uint32, x) == 0x2a -@test typeof(iround(Uint64, x)) == Uint64 && iround(Uint64, x) == 0x2a +@test typeof(iround(UInt8, x)) == UInt8 && iround(UInt8, x) == 0x2a +@test typeof(iround(UInt16, x)) == UInt16 && iround(UInt16, x) == 0x2a +@test typeof(iround(UInt32, x)) == UInt32 && iround(UInt32, x) == 0x2a +@test typeof(iround(UInt64, x)) == UInt64 && iround(UInt64, x) == 0x2a @test typeof(iround(Int64, x)) == Int64 && iround(Int64, x) == 42 @test typeof(iround(Int, x)) == Int && iround(Int, x) == 42 -@test typeof(iround(Uint, x)) == Uint && iround(Uint, x) == 0x2a +@test typeof(iround(UInt, x)) == UInt && iround(UInt, x) == 0x2a # string representation str = "1.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012e+00" @@ -494,33 +494,33 @@ c = BigInt("123456789012345678901234567891") #@test itrunc(Int8, x) == int8(y) #@test typeof(itrunc(Int8, x)) == Int8 -@test iceil(Uint64, x) == uint64(z) -@test typeof(iceil(Uint64, x)) == Uint64 -@test ifloor(Uint64, x) == uint64(y) -@test typeof(ifloor(Uint64, x)) == Uint64 -@test itrunc(Uint64, x) == uint64(y) -@test typeof(itrunc(Uint64, x)) == Uint64 - -@test iceil(Uint32, x) == uint32(z) -@test typeof(iceil(Uint32, x)) == Uint32 -@test ifloor(Uint32, x) == uint32(y) -@test typeof(ifloor(Uint32, x)) == Uint32 -@test itrunc(Uint32, x) == uint32(y) -@test typeof(itrunc(Uint32, x)) == Uint32 - -@test iceil(Uint16, x) == uint16(z) -@test typeof(iceil(Uint16, x)) == Uint16 -@test ifloor(Uint16, x) == uint16(y) -@test typeof(ifloor(Uint16, x)) == Uint16 -@test itrunc(Uint16, x) == uint16(y) -@test typeof(itrunc(Uint16, x)) == Uint16 - -#@test iceil(Uint8, x) == uint8(z) -#@test typeof(iceil(Uint8, x)) == Uint8 -#@test ifloor(Uint8, x) == uint8(y) -#@test typeof(ifloor(Uint8, x)) == Uint8 -#@test itrunc(Uint8, x) == uint8(y) -#@test typeof(itrunc(Uint8, x)) == Uint8 +@test iceil(UInt64, x) == uint64(z) +@test typeof(iceil(UInt64, x)) == UInt64 +@test ifloor(UInt64, x) == uint64(y) +@test typeof(ifloor(UInt64, x)) == UInt64 +@test itrunc(UInt64, x) == uint64(y) +@test typeof(itrunc(UInt64, x)) == UInt64 + +@test iceil(UInt32, x) == uint32(z) +@test typeof(iceil(UInt32, x)) == UInt32 +@test ifloor(UInt32, x) == uint32(y) +@test typeof(ifloor(UInt32, x)) == UInt32 +@test itrunc(UInt32, x) == uint32(y) +@test typeof(itrunc(UInt32, x)) == UInt32 + +@test iceil(UInt16, x) == uint16(z) +@test typeof(iceil(UInt16, x)) == UInt16 +@test ifloor(UInt16, x) == uint16(y) +@test typeof(ifloor(UInt16, x)) == UInt16 +@test itrunc(UInt16, x) == uint16(y) +@test typeof(itrunc(UInt16, x)) == UInt16 + +#@test iceil(UInt8, x) == uint8(z) +#@test typeof(iceil(UInt8, x)) == UInt8 +#@test ifloor(UInt8, x) == uint8(y) +#@test typeof(ifloor(UInt8, x)) == UInt8 +#@test itrunc(UInt8, x) == uint8(y) +#@test typeof(itrunc(UInt8, x)) == UInt8 @test iceil(a) == c @test typeof(iceil(a)) == BigInt @@ -728,11 +728,11 @@ d = BigFloat("-24.69135780242") @test typeof(BigFloat(typemax(Int128))) == BigFloat @test typeof(BigFloat(true)) == BigFloat -@test typeof(BigFloat(typemax(Uint8))) == BigFloat -@test typeof(BigFloat(typemax(Uint16))) == BigFloat -@test typeof(BigFloat(typemax(Uint32))) == BigFloat -@test typeof(BigFloat(typemax(Uint64))) == BigFloat -@test typeof(BigFloat(typemax(Uint128))) == BigFloat +@test typeof(BigFloat(typemax(UInt8))) == BigFloat +@test typeof(BigFloat(typemax(UInt16))) == BigFloat +@test typeof(BigFloat(typemax(UInt32))) == BigFloat +@test typeof(BigFloat(typemax(UInt64))) == BigFloat +@test typeof(BigFloat(typemax(UInt128))) == BigFloat @test typeof(BigFloat(realmax(Float32))) == BigFloat @test typeof(BigFloat(realmax(Float64))) == BigFloat @@ -775,8 +775,8 @@ tol = 1e-3 # issue #5963 @test typemax(Int128) == convert(BigFloat, typemax(Int128)) @test typemax(Int128) * big(1.0) == convert(BigFloat, typemax(Int128)) -@test typemax(Uint64) * big(1.0) == big(typemax(Uint64)) -@test typemax(Uint128) * big(1.0) == big(typemax(Uint128)) +@test typemax(UInt64) * big(1.0) == big(typemax(UInt64)) +@test typemax(UInt128) * big(1.0) == big(typemax(UInt128)) # issue #3399 i1 = BigInt(10)^int32(1000) diff --git a/test/netload/nettest.jl b/test/netload/nettest.jl index a2db8e58cf2c5..c370d07c8de0d 100644 --- a/test/netload/nettest.jl +++ b/test/netload/nettest.jl @@ -63,7 +63,7 @@ function test_send(exp) serv_sock = accept(server) bread = 0 while bread < size - serv_data = read(serv_sock, Uint8, block) + serv_data = read(serv_sock, UInt8, block) @assert length(serv_data) == block bread += block end @@ -77,7 +77,7 @@ function test_send(exp) take!(server_started) print("[CLIENT] Connecting to port $(port)\n") cli_sock = connect("localhost", port) - data = fill!(zeros(Uint8, block), int8(65)) + data = fill!(zeros(UInt8, block), int8(65)) cli_bsent = 0 while cli_bsent < size write(cli_sock, data) @@ -118,7 +118,7 @@ test_send(9) # Create an asynchronous task that can modify bread properly recv_task = @task begin while bread < xfer_size - data = read(s, Uint8, xfer_block) + data = read(s, UInt8, xfer_block) @assert length(data) == xfer_block bread += xfer_block end @@ -128,7 +128,7 @@ test_send(9) send_task = @task begin # write in chunks of xfer_block - data = fill!(zeros(Uint8, xfer_block), int8(65)) + data = fill!(zeros(UInt8, xfer_block), int8(65)) while bsent < xfer_size write(s, data) bsent += xfer_block diff --git a/test/nullable.jl b/test/nullable.jl index 6d0c1621b58d1..c79144a28d43a 100644 --- a/test/nullable.jl +++ b/test/nullable.jl @@ -8,10 +8,10 @@ types = [ Int32, Int64, Int8, - Uint16, - Uint32, - Uint64, - Uint8, + UInt16, + UInt32, + UInt64, + UInt8, ] # Nullable{T}() = new(true) @@ -64,10 +64,10 @@ p1s = [ "Nullable{Int32}()", "Nullable{Int64}()", "Nullable{Int8}()", - "Nullable{Uint16}()", - "Nullable{Uint32}()", - "Nullable{Uint64}()", - "Nullable{Uint8}()", + "Nullable{UInt16}()", + "Nullable{UInt32}()", + "Nullable{UInt64}()", + "Nullable{UInt8}()", ] p2s = [ @@ -208,17 +208,17 @@ for T in types @test_throws NullException (x4 == x4) end -# function hash(x::Nullable, h::Uint) +# function hash(x::Nullable, h::UInt) for T in types x1 = Nullable{T}() x2 = Nullable{T}() x3 = Nullable(zero(T)) x4 = Nullable(one(T)) - @test isa(hash(x1), Uint) - @test isa(hash(x2), Uint) - @test isa(hash(x3), Uint) - @test isa(hash(x4), Uint) + @test isa(hash(x1), UInt) + @test isa(hash(x2), UInt) + @test isa(hash(x3), UInt) + @test isa(hash(x4), UInt) @test hash(x1) == hash(x2) @test hash(x1) != hash(x3) diff --git a/test/numbers.jl b/test/numbers.jl index d778eeb72cbd3..5d6d836169369 100644 --- a/test/numbers.jl +++ b/test/numbers.jl @@ -96,92 +96,92 @@ end 1701411834604692317316873037158841057280 # definition and printing of extreme integers -@test bin(typemin(Uint8)) == "0" -@test bin(typemax(Uint8)) == "1"^8 -@test oct(typemin(Uint8)) == "0" -@test oct(typemax(Uint8)) == "377" -@test dec(typemin(Uint8)) == "0" -@test dec(typemax(Uint8)) == "255" -@test hex(typemin(Uint8)) == "0" -@test hex(typemax(Uint8)) == "ff" -@test repr(typemin(Uint8)) == "0x00" -@test string(typemin(Uint8)) == "0" -@test repr(typemax(Uint8)) == "0xff" -@test string(typemax(Uint8)) == "255" -@test base(3,typemin(Uint8)) == "0" -@test base(3,typemax(Uint8)) == "100110" -@test base(12,typemin(Uint8)) == "0" -@test base(12,typemax(Uint8)) == "193" - -@test bin(typemin(Uint16)) == "0" -@test bin(typemax(Uint16)) == "1"^16 -@test oct(typemin(Uint16)) == "0" -@test oct(typemax(Uint16)) == "177777" -@test dec(typemin(Uint16)) == "0" -@test dec(typemax(Uint16)) == "65535" -@test hex(typemin(Uint16)) == "0" -@test hex(typemax(Uint16)) == "ffff" -@test repr(typemin(Uint16)) == "0x0000" -@test string(typemin(Uint16)) == "0" -@test repr(typemax(Uint16)) == "0xffff" -@test string(typemax(Uint16)) == "65535" -@test base(3,typemin(Uint16)) == "0" -@test base(3,typemax(Uint16)) == "10022220020" -@test base(12,typemin(Uint16)) == "0" -@test base(12,typemax(Uint16)) == "31b13" - -@test bin(typemin(Uint32)) == "0" -@test bin(typemax(Uint32)) == "1"^32 -@test oct(typemin(Uint32)) == "0" -@test oct(typemax(Uint32)) == "37777777777" -@test dec(typemin(Uint32)) == "0" -@test dec(typemax(Uint32)) == "4294967295" -@test hex(typemin(Uint32)) == "0" -@test hex(typemax(Uint32)) == "ffffffff" -@test repr(typemin(Uint32)) == "0x00000000" -@test string(typemin(Uint32)) == "0" -@test repr(typemax(Uint32)) == "0xffffffff" -@test string(typemax(Uint32)) == "4294967295" -@test base(3,typemin(Uint32)) == "0" -@test base(3,typemax(Uint32)) == "102002022201221111210" -@test base(12,typemin(Uint32)) == "0" -@test base(12,typemax(Uint32)) == "9ba461593" - -@test bin(typemin(Uint64)) == "0" -@test bin(typemax(Uint64)) == "1"^64 -@test oct(typemin(Uint64)) == "0" -@test oct(typemax(Uint64)) == "1777777777777777777777" -@test dec(typemin(Uint64)) == "0" -@test dec(typemax(Uint64)) == "18446744073709551615" -@test hex(typemin(Uint64)) == "0" -@test hex(typemax(Uint64)) == "ffffffffffffffff" -@test repr(typemin(Uint64)) == "0x0000000000000000" -@test string(typemin(Uint64)) == "0" -@test repr(typemax(Uint64)) == "0xffffffffffffffff" -@test string(typemax(Uint64)) == "18446744073709551615" -@test base(3,typemin(Uint64)) == "0" -@test base(3,typemax(Uint64)) == "11112220022122120101211020120210210211220" -@test base(12,typemin(Uint64)) == "0" -@test base(12,typemax(Uint64)) == "839365134a2a240713" - -@test bin(typemin(Uint128)) == "0" -@test bin(typemax(Uint128)) == "1"^128 -@test oct(typemin(Uint128)) == "0" -@test oct(typemax(Uint128)) == "3777777777777777777777777777777777777777777" -@test hex(typemin(Uint128)) == "0" -@test hex(typemax(Uint128)) == "ffffffffffffffffffffffffffffffff" -@test repr(typemin(Uint128)) == "0x00000000000000000000000000000000" -@test string(typemin(Uint128)) == "0" -@test repr(typemax(Uint128)) == "0xffffffffffffffffffffffffffffffff" -@test string(typemax(Uint128)) == "340282366920938463463374607431768211455" - -@test dec(typemin(Uint128)) == "0" -@test dec(typemax(Uint128)) == "340282366920938463463374607431768211455" -@test base(3,typemin(Uint128)) == "0" -@test base(3,typemax(Uint128)) == +@test bin(typemin(UInt8)) == "0" +@test bin(typemax(UInt8)) == "1"^8 +@test oct(typemin(UInt8)) == "0" +@test oct(typemax(UInt8)) == "377" +@test dec(typemin(UInt8)) == "0" +@test dec(typemax(UInt8)) == "255" +@test hex(typemin(UInt8)) == "0" +@test hex(typemax(UInt8)) == "ff" +@test repr(typemin(UInt8)) == "0x00" +@test string(typemin(UInt8)) == "0" +@test repr(typemax(UInt8)) == "0xff" +@test string(typemax(UInt8)) == "255" +@test base(3,typemin(UInt8)) == "0" +@test base(3,typemax(UInt8)) == "100110" +@test base(12,typemin(UInt8)) == "0" +@test base(12,typemax(UInt8)) == "193" + +@test bin(typemin(UInt16)) == "0" +@test bin(typemax(UInt16)) == "1"^16 +@test oct(typemin(UInt16)) == "0" +@test oct(typemax(UInt16)) == "177777" +@test dec(typemin(UInt16)) == "0" +@test dec(typemax(UInt16)) == "65535" +@test hex(typemin(UInt16)) == "0" +@test hex(typemax(UInt16)) == "ffff" +@test repr(typemin(UInt16)) == "0x0000" +@test string(typemin(UInt16)) == "0" +@test repr(typemax(UInt16)) == "0xffff" +@test string(typemax(UInt16)) == "65535" +@test base(3,typemin(UInt16)) == "0" +@test base(3,typemax(UInt16)) == "10022220020" +@test base(12,typemin(UInt16)) == "0" +@test base(12,typemax(UInt16)) == "31b13" + +@test bin(typemin(UInt32)) == "0" +@test bin(typemax(UInt32)) == "1"^32 +@test oct(typemin(UInt32)) == "0" +@test oct(typemax(UInt32)) == "37777777777" +@test dec(typemin(UInt32)) == "0" +@test dec(typemax(UInt32)) == "4294967295" +@test hex(typemin(UInt32)) == "0" +@test hex(typemax(UInt32)) == "ffffffff" +@test repr(typemin(UInt32)) == "0x00000000" +@test string(typemin(UInt32)) == "0" +@test repr(typemax(UInt32)) == "0xffffffff" +@test string(typemax(UInt32)) == "4294967295" +@test base(3,typemin(UInt32)) == "0" +@test base(3,typemax(UInt32)) == "102002022201221111210" +@test base(12,typemin(UInt32)) == "0" +@test base(12,typemax(UInt32)) == "9ba461593" + +@test bin(typemin(UInt64)) == "0" +@test bin(typemax(UInt64)) == "1"^64 +@test oct(typemin(UInt64)) == "0" +@test oct(typemax(UInt64)) == "1777777777777777777777" +@test dec(typemin(UInt64)) == "0" +@test dec(typemax(UInt64)) == "18446744073709551615" +@test hex(typemin(UInt64)) == "0" +@test hex(typemax(UInt64)) == "ffffffffffffffff" +@test repr(typemin(UInt64)) == "0x0000000000000000" +@test string(typemin(UInt64)) == "0" +@test repr(typemax(UInt64)) == "0xffffffffffffffff" +@test string(typemax(UInt64)) == "18446744073709551615" +@test base(3,typemin(UInt64)) == "0" +@test base(3,typemax(UInt64)) == "11112220022122120101211020120210210211220" +@test base(12,typemin(UInt64)) == "0" +@test base(12,typemax(UInt64)) == "839365134a2a240713" + +@test bin(typemin(UInt128)) == "0" +@test bin(typemax(UInt128)) == "1"^128 +@test oct(typemin(UInt128)) == "0" +@test oct(typemax(UInt128)) == "3777777777777777777777777777777777777777777" +@test hex(typemin(UInt128)) == "0" +@test hex(typemax(UInt128)) == "ffffffffffffffffffffffffffffffff" +@test repr(typemin(UInt128)) == "0x00000000000000000000000000000000" +@test string(typemin(UInt128)) == "0" +@test repr(typemax(UInt128)) == "0xffffffffffffffffffffffffffffffff" +@test string(typemax(UInt128)) == "340282366920938463463374607431768211455" + +@test dec(typemin(UInt128)) == "0" +@test dec(typemax(UInt128)) == "340282366920938463463374607431768211455" +@test base(3,typemin(UInt128)) == "0" +@test base(3,typemax(UInt128)) == "202201102121002021012000211012011021221022212021111001022110211020010021100121010" -@test base(12,typemin(Uint128)) == "0" -@test base(12,typemax(Uint128)) == "5916b64b41143526a777873841863a6a6993" +@test base(12,typemin(UInt128)) == "0" +@test base(12,typemax(UInt128)) == "5916b64b41143526a777873841863a6a6993" @test bin(typemin(Int8)) == "-1"*"0"^7 @test bin(typemax(Int8)) == "1"^7 @@ -506,7 +506,7 @@ for x=-5:5, y=-5:5 end end -function _cmp_(x::Union(Int64,Uint64), y::Float64) +function _cmp_(x::Union(Int64,UInt64), y::Float64) if x==int64(2)^53-2 && y==2.0^53-2; return 0; end if x==int64(2)^53-2 && y==2.0^53-1; return -1; end if x==int64(2)^53-2 && y==2.0^53 ; return -1; end @@ -678,16 +678,16 @@ end @test 2.0^63 == uint64(2)^63 @test 2.0^63 != uint64(2)^63+1 -@test typemax(Uint64) != 2.0^64 +@test typemax(UInt64) != 2.0^64 -@test typemax(Uint64) < float64(typemax(Uint64)) +@test typemax(UInt64) < float64(typemax(UInt64)) @test typemax(Int64) < float64(typemax(Int64)) -@test typemax(Uint64) <= float64(typemax(Uint64)) +@test typemax(UInt64) <= float64(typemax(UInt64)) @test typemax(Int64) <= float64(typemax(Int64)) -@test float64(typemax(Uint64)) > typemax(Uint64) +@test float64(typemax(UInt64)) > typemax(UInt64) @test float64(typemax(Int64)) > typemax(Int64) -@test float64(typemax(Uint64)) >= typemax(Uint64) +@test float64(typemax(UInt64)) >= typemax(UInt64) @test float64(typemax(Int64)) >= typemax(Int64) @test float64(int128(0)) == 0.0 @@ -702,10 +702,10 @@ end @test float32(typemin(Int128)) == -2.0f0^127 @test float64(typemax(Int128)) == 2.0^127 @test float32(typemax(Int128)) == 2.0f0^127 -@test float64(typemin(Uint128)) == 0.0 -@test float32(typemin(Uint128)) == 0.0f0 -@test float64(typemax(Uint128)) == 2.0^128 -@test float32(typemax(Uint128)) == 2.0f0^128 +@test float64(typemin(UInt128)) == 0.0 +@test float32(typemin(UInt128)) == 0.0f0 +@test float64(typemax(UInt128)) == 2.0^128 +@test float32(typemax(UInt128)) == 2.0f0^128 @test int128(-2.0^127) == typemin(Int128) @test float64(uint128(3.7e19)) == 3.7e19 @@ -816,13 +816,13 @@ for T in [Int8, Int16, Int32, Int64, Int128] #end end -#for T in (Uint8,Uint16,Uint32,Uint64,Uint128) +#for T in (UInt8,UInt16,UInt32,UInt64,UInt128) # x in (typemin(T),one(T),typemax(T)) # @test unsigned(signed(x)) == x #end for S = [Int8, Int16, Int32, Int64], - U = [Uint8, Uint16, Uint32, Uint64] + U = [UInt8, UInt16, UInt32, UInt64] @test !(-one(S) == typemax(U)) @test -one(S) != typemax(U) @test -one(S) < typemax(U) @@ -830,7 +830,7 @@ for S = [Int8, Int16, Int32, Int64], end # check type of constructed rationals -int_types = [Int8, Uint8, Int16, Uint16, Int32, Uint32, Int64, Uint64] +int_types = [Int8, UInt8, Int16, UInt16, Int32, UInt32, Int64, UInt64] for N = int_types, D = int_types T = promote_type(N,D) @test typeof(convert(N,2)//convert(D,3)) <: Rational{T} @@ -840,9 +840,9 @@ end @test typeof(convert(Rational{Integer},1)) === Rational{Integer} # check type of constructed complexes -real_types = [Int8, Uint8, Int16, Uint16, Int32, Uint32, Int64, Uint64, Float32, Float64, - Rational{Int8}, Rational{Uint8}, Rational{Int16}, Rational{Uint16}, - Rational{Int32}, Rational{Uint32}, Rational{Int64}, Rational{Uint64}] +real_types = [Int8, UInt8, Int16, UInt16, Int32, UInt32, Int64, UInt64, Float32, Float64, + Rational{Int8}, Rational{UInt8}, Rational{Int16}, Rational{UInt16}, + Rational{Int32}, Rational{UInt32}, Rational{Int64}, Rational{UInt64}] for A = real_types, B = real_types T = promote_type(A,B) @test typeof(Complex(convert(A,2),convert(B,3))) <: Complex{T} @@ -1144,7 +1144,7 @@ end for x=Any[typemin(Int64), -typemax(Int64), -typemax(Int64)+1, -typemax(Int64)+2, typemax(Int64)-2, typemax(Int64)-1, typemax(Int64), - typemax(Uint64)-1, typemax(Uint64)-2, typemax(Uint64)], + typemax(UInt64)-1, typemax(UInt64)-2, typemax(UInt64)], y=[-7,-2,-1,1,2,7] if x >= 0 @test div(unsigned(x),y) == unsigned(div(x,y)) @@ -1162,19 +1162,19 @@ for x=0:5, y=1:5 @test div(uint(x),uint(y)) == div(x,y) @test div(uint(x),y) == div(x,y) @test div(x,uint(y)) == div(x,y) - @test div(uint(x),-y) == reinterpret(Uint,div(x,-y)) + @test div(uint(x),-y) == reinterpret(UInt,div(x,-y)) @test div(-x,uint(y)) == div(-x,y) @test fld(uint(x),uint(y)) == fld(x,y) @test fld(uint(x),y) == fld(x,y) @test fld(x,uint(y)) == fld(x,y) - @test fld(uint(x),-y) == reinterpret(Uint,fld(x,-y)) + @test fld(uint(x),-y) == reinterpret(UInt,fld(x,-y)) @test fld(-x,uint(y)) == fld(-x,y) @test cld(uint(x),uint(y)) == cld(x,y) @test cld(uint(x),y) == cld(x,y) @test cld(x,uint(y)) == cld(x,y) - @test cld(uint(x),-y) == reinterpret(Uint,cld(x,-y)) + @test cld(uint(x),-y) == reinterpret(UInt,cld(x,-y)) @test cld(-x,uint(y)) == cld(-x,y) @test rem(uint(x),uint(y)) == rem(x,y) @@ -1190,12 +1190,12 @@ for x=0:5, y=1:5 @test mod(-x,uint(y)) == mod(-x,y) end -@test div(typemax(Uint64) , 1) == typemax(Uint64) -@test div(typemax(Uint64) ,-1) == -typemax(Uint64) -@test div(typemax(Uint64)-1, 1) == typemax(Uint64)-1 -@test div(typemax(Uint64)-1,-1) == -typemax(Uint64)+1 -@test div(typemax(Uint64)-2, 1) == typemax(Uint64)-2 -@test div(typemax(Uint64)-2,-1) == -typemax(Uint64)+2 +@test div(typemax(UInt64) , 1) == typemax(UInt64) +@test div(typemax(UInt64) ,-1) == -typemax(UInt64) +@test div(typemax(UInt64)-1, 1) == typemax(UInt64)-1 +@test div(typemax(UInt64)-1,-1) == -typemax(UInt64)+1 +@test div(typemax(UInt64)-2, 1) == typemax(UInt64)-2 +@test div(typemax(UInt64)-2,-1) == -typemax(UInt64)+2 @test signed(div(unsigned(typemax(Int64))+2, 1)) == typemax(Int64)+2 @test signed(div(unsigned(typemax(Int64))+2,-1)) == -typemax(Int64)-2 @@ -1204,20 +1204,20 @@ end @test signed(div(unsigned(typemax(Int64)) , 1)) == typemax(Int64) @test signed(div(unsigned(typemax(Int64)) ,-1)) == -typemax(Int64) -@test signed(div(typemax(Uint),typemax(Int))) == 2 -@test signed(div(typemax(Uint),(typemax(Int)>>1)+1)) == 3 -@test signed(div(typemax(Uint),typemax(Int)>>1)) == 4 -@test signed(div(typemax(Uint),typemin(Int))) == -1 -@test signed(div(typemax(Uint),typemin(Int)+1)) == -2 -@test signed(div(typemax(Uint),typemin(Int)>>1)) == -3 -@test signed(div(typemax(Uint),(typemin(Int)>>1)+1)) == -4 - -@test fld(typemax(Uint64) , 1) == typemax(Uint64) -@test fld(typemax(Uint64) ,-1) == -typemax(Uint64) -@test fld(typemax(Uint64)-1, 1) == typemax(Uint64)-1 -@test fld(typemax(Uint64)-1,-1) == -typemax(Uint64)+1 -@test fld(typemax(Uint64)-2, 1) == typemax(Uint64)-2 -@test fld(typemax(Uint64)-2,-1) == -typemax(Uint64)+2 +@test signed(div(typemax(UInt),typemax(Int))) == 2 +@test signed(div(typemax(UInt),(typemax(Int)>>1)+1)) == 3 +@test signed(div(typemax(UInt),typemax(Int)>>1)) == 4 +@test signed(div(typemax(UInt),typemin(Int))) == -1 +@test signed(div(typemax(UInt),typemin(Int)+1)) == -2 +@test signed(div(typemax(UInt),typemin(Int)>>1)) == -3 +@test signed(div(typemax(UInt),(typemin(Int)>>1)+1)) == -4 + +@test fld(typemax(UInt64) , 1) == typemax(UInt64) +@test fld(typemax(UInt64) ,-1) == -typemax(UInt64) +@test fld(typemax(UInt64)-1, 1) == typemax(UInt64)-1 +@test fld(typemax(UInt64)-1,-1) == -typemax(UInt64)+1 +@test fld(typemax(UInt64)-2, 1) == typemax(UInt64)-2 +@test fld(typemax(UInt64)-2,-1) == -typemax(UInt64)+2 @test signed(fld(unsigned(typemax(Int64))+2, 1)) == typemax(Int64)+2 @test signed(fld(unsigned(typemax(Int64))+2,-1)) == -typemax(Int64)-2 @@ -1226,20 +1226,20 @@ end @test signed(fld(unsigned(typemax(Int64)) , 1)) == typemax(Int64) @test signed(fld(unsigned(typemax(Int64)) ,-1)) == -typemax(Int64) -@test signed(fld(typemax(Uint),typemax(Int))) == 2 -@test signed(fld(typemax(Uint),(typemax(Int)>>1)+1)) == 3 -@test signed(fld(typemax(Uint),typemax(Int)>>1)) == 4 -@test signed(fld(typemax(Uint),typemin(Int))) == -2 -@test signed(fld(typemax(Uint),typemin(Int)+1)) == -3 -@test signed(fld(typemax(Uint),typemin(Int)>>1)) == -4 -@test signed(fld(typemax(Uint),(typemin(Int)>>1)+1)) == -5 - -@test cld(typemax(Uint64) , 1) == typemax(Uint64) -@test cld(typemax(Uint64) ,-1) == -typemax(Uint64) -@test cld(typemax(Uint64)-1, 1) == typemax(Uint64)-1 -@test cld(typemax(Uint64)-1,-1) == -typemax(Uint64)+1 -@test cld(typemax(Uint64)-2, 1) == typemax(Uint64)-2 -@test cld(typemax(Uint64)-2,-1) == -typemax(Uint64)+2 +@test signed(fld(typemax(UInt),typemax(Int))) == 2 +@test signed(fld(typemax(UInt),(typemax(Int)>>1)+1)) == 3 +@test signed(fld(typemax(UInt),typemax(Int)>>1)) == 4 +@test signed(fld(typemax(UInt),typemin(Int))) == -2 +@test signed(fld(typemax(UInt),typemin(Int)+1)) == -3 +@test signed(fld(typemax(UInt),typemin(Int)>>1)) == -4 +@test signed(fld(typemax(UInt),(typemin(Int)>>1)+1)) == -5 + +@test cld(typemax(UInt64) , 1) == typemax(UInt64) +@test cld(typemax(UInt64) ,-1) == -typemax(UInt64) +@test cld(typemax(UInt64)-1, 1) == typemax(UInt64)-1 +@test cld(typemax(UInt64)-1,-1) == -typemax(UInt64)+1 +@test cld(typemax(UInt64)-2, 1) == typemax(UInt64)-2 +@test cld(typemax(UInt64)-2,-1) == -typemax(UInt64)+2 @test signed(cld(unsigned(typemax(Int64))+2, 1)) == typemax(Int64)+2 @test signed(cld(unsigned(typemax(Int64))+2,-1)) == -typemax(Int64)-2 @@ -1248,13 +1248,13 @@ end @test signed(cld(unsigned(typemax(Int64)) , 1)) == typemax(Int64) @test signed(cld(unsigned(typemax(Int64)) ,-1)) == -typemax(Int64) -@test signed(cld(typemax(Uint),typemax(Int))) == 3 -@test signed(cld(typemax(Uint),(typemax(Int)>>1)+1)) == 4 -@test signed(cld(typemax(Uint),typemax(Int)>>1)) == 5 -@test signed(cld(typemax(Uint),typemin(Int))) == -1 -@test signed(cld(typemax(Uint),typemin(Int)+1)) == -2 -@test signed(cld(typemax(Uint),typemin(Int)>>1)) == -3 -@test signed(cld(typemax(Uint),(typemin(Int)>>1)+1)) == -4 +@test signed(cld(typemax(UInt),typemax(Int))) == 3 +@test signed(cld(typemax(UInt),(typemax(Int)>>1)+1)) == 4 +@test signed(cld(typemax(UInt),typemax(Int)>>1)) == 5 +@test signed(cld(typemax(UInt),typemin(Int))) == -1 +@test signed(cld(typemax(UInt),typemin(Int)+1)) == -2 +@test signed(cld(typemax(UInt),typemin(Int)>>1)) == -3 +@test signed(cld(typemax(UInt),(typemin(Int)>>1)+1)) == -4 # issue #4156 @test fld(1.4,0.35667494393873234) == 3.0 @@ -1333,14 +1333,14 @@ end @test iround(Int64, 9.223372036854775e18) == 9223372036854774784 @test_throws InexactError iround(Int64, -9.223372036854778e18) @test iround(Int64, -9.223372036854776e18) == typemin(Int64) -@test_throws InexactError iround(Uint64, 1.8446744073709552e19) -@test iround(Uint64, 1.844674407370955e19) == 0xfffffffffffff800 +@test_throws InexactError iround(UInt64, 1.8446744073709552e19) +@test iround(UInt64, 1.844674407370955e19) == 0xfffffffffffff800 @test_throws InexactError iround(Int32, 2.1474836f9) @test iround(Int32, 2.1474835f9) == 2147483520 @test_throws InexactError iround(Int32, -2.147484f9) @test iround(Int32, -2.1474836f9) == typemin(Int32) -@test_throws InexactError iround(Uint32, 4.2949673f9) -@test iround(Uint32, 4.294967f9) == 0xffffff00 +@test_throws InexactError iround(UInt32, 4.2949673f9) +@test iround(UInt32, 4.294967f9) == 0xffffff00 for n = 1:100 m = 1 @@ -1350,7 +1350,7 @@ for n = 1:100 @test n == m end -@test iround(Uint,-0.0) == 0 +@test iround(UInt,-0.0) == 0 @test iround(Int,-0.0) == 0 @test iround(Int, 0.5) == 1 @@ -1358,20 +1358,20 @@ end @test iround(Int, -0.5) == -1 @test iround(Int, nextfloat(-0.5)) == 0 -@test iround(Uint, 0.5) == 1 -@test iround(Uint, prevfloat(0.5)) == 0 -@test_throws InexactError iround(Uint, -0.5) -@test iround(Uint, nextfloat(-0.5)) == 0 +@test iround(UInt, 0.5) == 1 +@test iround(UInt, prevfloat(0.5)) == 0 +@test_throws InexactError iround(UInt, -0.5) +@test iround(UInt, nextfloat(-0.5)) == 0 @test iround(Int, 0.5f0) == 1 @test iround(Int, prevfloat(0.5f0)) == 0 @test iround(Int, -0.5f0) == -1 @test iround(Int, nextfloat(-0.5f0)) == 0 -@test iround(Uint, 0.5f0) == 1 -@test iround(Uint, prevfloat(0.5f0)) == 0 -@test_throws InexactError iround(Uint, -0.5f0) -@test iround(Uint, nextfloat(-0.5f0)) == 0 +@test iround(UInt, 0.5f0) == 1 +@test iround(UInt, prevfloat(0.5f0)) == 0 +@test_throws InexactError iround(UInt, -0.5f0) +@test iround(UInt, nextfloat(-0.5f0)) == 0 # numbers that can't be rounded by trunc(x+0.5) @test iround(Int64, 2.0^52 + 1) == 4503599627370497 @@ -1380,25 +1380,25 @@ end # binary literals @test 0b1010101 == 0x55 -@test isa(0b00000000,Uint8) -@test isa(0b000000000,Uint16) -@test isa(0b0000000000000000,Uint16) -@test isa(0b00000000000000000,Uint32) -@test isa(0b00000000000000000000000000000000,Uint32) -@test isa(0b000000000000000000000000000000000,Uint64) -@test isa(0b0000000000000000000000000000000000000000000000000000000000000000,Uint64) -@test isa(0b00000000000000000000000000000000000000000000000000000000000000000,Uint128) -@test isa(0b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,Uint128) +@test isa(0b00000000,UInt8) +@test isa(0b000000000,UInt16) +@test isa(0b0000000000000000,UInt16) +@test isa(0b00000000000000000,UInt32) +@test isa(0b00000000000000000000000000000000,UInt32) +@test isa(0b000000000000000000000000000000000,UInt64) +@test isa(0b0000000000000000000000000000000000000000000000000000000000000000,UInt64) +@test isa(0b00000000000000000000000000000000000000000000000000000000000000000,UInt128) +@test isa(0b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,UInt128) @test isa(0b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,BigInt) -@test isa(0b11111111,Uint8) -@test isa(0b111111111,Uint16) -@test isa(0b1111111111111111,Uint16) -@test isa(0b11111111111111111,Uint32) -@test isa(0b11111111111111111111111111111111,Uint32) -@test isa(0b111111111111111111111111111111111,Uint64) -@test isa(0b1111111111111111111111111111111111111111111111111111111111111111,Uint64) -@test isa(0b11111111111111111111111111111111111111111111111111111111111111111,Uint128) -@test isa(0b11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111,Uint128) +@test isa(0b11111111,UInt8) +@test isa(0b111111111,UInt16) +@test isa(0b1111111111111111,UInt16) +@test isa(0b11111111111111111,UInt32) +@test isa(0b11111111111111111111111111111111,UInt32) +@test isa(0b111111111111111111111111111111111,UInt64) +@test isa(0b1111111111111111111111111111111111111111111111111111111111111111,UInt64) +@test isa(0b11111111111111111111111111111111111111111111111111111111111111111,UInt128) +@test isa(0b11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111,UInt128) @test isa(0b111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111,BigInt) # octal literals @@ -1407,52 +1407,52 @@ end @test 0o100 == 0x40 @test 0o1000 == 0x200 @test 0o724 == 0x1d4 -@test isa(0o377,Uint8) -@test isa(0o00,Uint8) -@test isa(0o000,Uint16) -@test isa(0o00000,Uint16) -@test isa(0o000000,Uint32) -@test isa(0o0000000000,Uint32) -@test isa(0o00000000000,Uint64) -@test isa(0o000000000000000000000,Uint64) -@test isa(0o0000000000000000000000,Uint128) -@test isa(0o000000000000000000000000000000000000000000,Uint128) +@test isa(0o377,UInt8) +@test isa(0o00,UInt8) +@test isa(0o000,UInt16) +@test isa(0o00000,UInt16) +@test isa(0o000000,UInt32) +@test isa(0o0000000000,UInt32) +@test isa(0o00000000000,UInt64) +@test isa(0o000000000000000000000,UInt64) +@test isa(0o0000000000000000000000,UInt128) +@test isa(0o000000000000000000000000000000000000000000,UInt128) @test isa(0o0000000000000000000000000000000000000000000,BigInt) -@test isa(0o11,Uint8) -@test isa(0o111,Uint8) -@test isa(0o11111,Uint16) -@test isa(0o111111,Uint16) -@test isa(0o1111111111,Uint32) -@test isa(0o11111111111,Uint32) -@test isa(0o111111111111111111111,Uint64) -@test isa(0o1111111111111111111111,Uint64) -@test isa(0o111111111111111111111111111111111111111111,Uint128) -@test isa(0o1111111111111111111111111111111111111111111,Uint128) +@test isa(0o11,UInt8) +@test isa(0o111,UInt8) +@test isa(0o11111,UInt16) +@test isa(0o111111,UInt16) +@test isa(0o1111111111,UInt32) +@test isa(0o11111111111,UInt32) +@test isa(0o111111111111111111111,UInt64) +@test isa(0o1111111111111111111111,UInt64) +@test isa(0o111111111111111111111111111111111111111111,UInt128) +@test isa(0o1111111111111111111111111111111111111111111,UInt128) @test isa(0o11111111111111111111111111111111111111111111,BigInt) @test 0o4000000000000000000000000000000000000000000 == 340282366920938463463374607431768211456 # hexadecimal literals -@test isa(0x00,Uint8) -@test isa(0x000,Uint16) -@test isa(0x0000,Uint16) -@test isa(0x00000,Uint32) -@test isa(0x00000000,Uint32) -@test isa(0x000000000,Uint64) -@test isa(0x0000000000000000,Uint64) -@test isa(0x00000000000000000,Uint128) -@test isa(0x00000000000000000000000000000000,Uint128) +@test isa(0x00,UInt8) +@test isa(0x000,UInt16) +@test isa(0x0000,UInt16) +@test isa(0x00000,UInt32) +@test isa(0x00000000,UInt32) +@test isa(0x000000000,UInt64) +@test isa(0x0000000000000000,UInt64) +@test isa(0x00000000000000000,UInt128) +@test isa(0x00000000000000000000000000000000,UInt128) @test isa(0x000000000000000000000000000000000,BigInt) -@test isa(0x11,Uint8) -@test isa(0x111,Uint16) -@test isa(0x1111,Uint16) -@test isa(0x11111,Uint32) -@test isa(0x11111111,Uint32) -@test isa(0x111111111,Uint64) -@test isa(0x1111111111111111,Uint64) -@test isa(0x11111111111111111,Uint128) -@test isa(0x11111111111111111111111111111111,Uint128) +@test isa(0x11,UInt8) +@test isa(0x111,UInt16) +@test isa(0x1111,UInt16) +@test isa(0x11111,UInt32) +@test isa(0x11111111,UInt32) +@test isa(0x111111111,UInt64) +@test isa(0x1111111111111111,UInt64) +@test isa(0x11111111111111111,UInt128) +@test isa(0x11111111111111111111111111111111,UInt128) @test isa(0x111111111111111111111111111111111,BigInt) # "-" is not part of unsigned literals @@ -1472,10 +1472,10 @@ end @test -0b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001 == -(0b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001) -@test isa(-0x00,Uint8) -@test isa(-0x0000000000000000,Uint64) -@test isa(-0x00000000000000000,Uint128) -@test isa(-0x00000000000000000000000000000000,Uint128) +@test isa(-0x00,UInt8) +@test isa(-0x0000000000000000,UInt64) +@test isa(-0x00000000000000000,UInt128) +@test isa(-0x00000000000000000000000000000000,UInt128) @test isa(-0x000000000000000000000000000000000,BigInt) # float32 literals @@ -1595,7 +1595,7 @@ approx_eq(a, b) = approx_eq(a, b, 1e-6) @test rationalize(Int16, 0.2264705884044309) == 77//340 @test rationalize(Int16, 0.39999899264235683) == 2//5 @test rationalize(Int16, 1.1264233500618559e-5) == 0//1 -@test rationalize(Uint16, 0.6666652791223875) == 2//3 +@test rationalize(UInt16, 0.6666652791223875) == 2//3 @test rationalize(Int8, 0.9374813124660655) == 15//16 @test rationalize(Int8, 0.003803032342443835) == 0//1 @@ -1808,7 +1808,7 @@ end @test !isprime(0xffffffffffffffc9) # issue #5210 -@test prod([ k^v for (k,v) in factor(typemax(Uint32)) ]) == typemax(Uint32) +@test prod([ k^v for (k,v) in factor(typemax(UInt32)) ]) == typemax(UInt32) @test prod([ k^v for (k,v) in factor(typemax(Int8)) ]) == typemax(Int8) # rational-exponent promotion rules (issue #3155): @@ -1933,7 +1933,7 @@ end # modular multiplicative inverses of odd numbers via exponentiation -for T = (Uint8,Int8,Uint16,Int16,Uint32,Int32,Uint64,Int64,Uint128,Int128) +for T = (UInt8,Int8,UInt16,Int16,UInt32,Int32,UInt64,Int64,UInt128,Int128) for n = 1:2:1000 @test n*(n^typemax(T)) & typemax(T) == 1 n = rand(T) | one(T) @@ -1982,8 +1982,8 @@ end # issue #7441 @test_throws InexactError int32(2.0^50) -@test_throws InexactError iround(Uint8, 255.5) -@test iround(Uint8, 255.4) === 0xff +@test_throws InexactError iround(UInt8, 255.5) +@test iround(UInt8, 255.4) === 0xff @test_throws InexactError iround(Int16, -32768.7) @test iround(Int16, -32768.1) === int16(-32768) @@ -2025,8 +2025,8 @@ let a = zeros(Int,(2,4)) @test a == [0 1 0 1; 0 0 1 1] end -@test_throws InexactError convert(Uint8, 256) -@test_throws InexactError convert(Uint, -1) +@test_throws InexactError convert(UInt8, 256) +@test_throws InexactError convert(UInt, -1) @test_throws InexactError convert(Int, big(2)^100) @test_throws InexactError convert(Int16, big(2)^100) -@test_throws InexactError convert(Int, typemax(Uint)) +@test_throws InexactError convert(Int, typemax(UInt)) diff --git a/test/parallel.jl b/test/parallel.jl index 02003bca5c6a5..7626bb5154583 100644 --- a/test/parallel.jl +++ b/test/parallel.jl @@ -177,8 +177,8 @@ if haskey(ENV, "PTEST_FULL") # needs at least 4 processors (which are being created above for the @parallel tests) s = "a"*"bcdefghijklmnopqrstuvwxyz"^100; ups = "A"*"BCDEFGHIJKLMNOPQRSTUVWXYZ"^100; - @test ups == bytestring(Uint8[uint8(c) for c in pmap(x->uppercase(x), s)]) - @test ups == bytestring(Uint8[uint8(c) for c in pmap(x->uppercase(char(x)), s.data)]) + @test ups == bytestring(UInt8[uint8(c) for c in pmap(x->uppercase(x), s)]) + @test ups == bytestring(UInt8[uint8(c) for c in pmap(x->uppercase(char(x)), s.data)]) # retry, on error exit res = pmap(x->(x=='a') ? error("test error. don't panic.") : uppercase(x), s; err_retry=true, err_stop=true); @@ -193,7 +193,7 @@ if haskey(ENV, "PTEST_FULL") # retry, on error continue res = pmap(x->iseven(myid()) ? error("test error. don't panic.") : uppercase(x), s; err_retry=true, err_stop=false); @test length(res) == length(ups) - @test ups == bytestring(Uint8[uint8(c) for c in res]) + @test ups == bytestring(UInt8[uint8(c) for c in res]) # no retry, on error continue res = pmap(x->(x=='a') ? error("test error. don't panic.") : uppercase(x), s; err_retry=false, err_stop=false); diff --git a/test/perf/kernel/actor_centrality.jl b/test/perf/kernel/actor_centrality.jl index 6eaa4b91e7577..98c9a6e2ffa41 100644 --- a/test/perf/kernel/actor_centrality.jl +++ b/test/perf/kernel/actor_centrality.jl @@ -15,7 +15,7 @@ function get(G::Graph, name) end function centrality_mean(G::Graph, start_node) - dists = Dict{Node,Uint64}() + dists = Dict{Node,UInt64}() next = Set([G[start_node]]) cdist = 0 diff --git a/test/perf/kernel/go_benchmark.jl b/test/perf/kernel/go_benchmark.jl index 45bb749c33325..7d54ee3dffe35 100644 --- a/test/perf/kernel/go_benchmark.jl +++ b/test/perf/kernel/go_benchmark.jl @@ -19,21 +19,21 @@ const BLACK_TERRITORY = 4 const UNKNOWN = 5 type XorRand - state::Uint32 + state::UInt32 end -function xor_srand(rand::XorRand, seed::Uint32) +function xor_srand(rand::XorRand, seed::UInt32) rand.state = seed end -function xor_randn(rand::XorRand, n::Uint32) +function xor_randn(rand::XorRand, n::UInt32) rand.state $= rand.state << 13 rand.state $= rand.state >> 17 rand.state $= rand.state << 5 rand.state % n end -xor_randn(rand::XorRand, n::Int) = convert(Int, xor_randn(rand, convert(Uint32, n))) +xor_randn(rand::XorRand, n::Int) = convert(Int, xor_randn(rand, convert(UInt32, n))) # Offsets for the four directly adjacent neighbors. Used for looping. const deltai = (-1, 1, 0, 0) @@ -63,11 +63,11 @@ type Board rand::XorRand function Board(n::Int) - init(new(), n, convert(Uint32, 2463534242)) + init(new(), n, convert(UInt32, 2463534242)) end end -function init(board::Board, n::Int, seed::Uint32) +function init(board::Board, n::Int, seed::UInt32) board.size = n board.komi = 0.0 board.board = zeros(Int, n, n) @@ -92,7 +92,7 @@ function set_komi(board::Board, komi::Float64) board.komi = komi end -function set_random_seed(board::Board, seed::Uint32) +function set_random_seed(board::Board, seed::UInt32) xor_srand(board.rand, seed) end @@ -433,7 +433,7 @@ function compute_score(board::Board) end function benchmark(num_games_per_point::Int) - random_seed = convert(Uint32, 1) + random_seed = convert(UInt32, 1) board_size = 9 komi = 0.5 diff --git a/test/perf/kernel/ziggurat.jl b/test/perf/kernel/ziggurat.jl index eeca6c8fc14a8..c2c6567ccbe19 100644 --- a/test/perf/kernel/ziggurat.jl +++ b/test/perf/kernel/ziggurat.jl @@ -112,7 +112,7 @@ function randn_zig() x = 0.0 while (true) - U = rand(Uint32) + U = rand(UInt32) i = 1 + (U & 0x0000007F) # 7 bit to choose the step sign = U & 0x00000080 # 1 bit for the sign j = U>>8 # 24 bit for the x-value diff --git a/test/perf/micro/perf.jl b/test/perf/micro/perf.jl index 943bc9992adfe..6c21ebc6628c8 100644 --- a/test/perf/micro/perf.jl +++ b/test/perf/micro/perf.jl @@ -14,7 +14,7 @@ fib(n) = n < 2 ? n : fib(n-1) + fib(n-2) function parseintperf(t) local n, m for i=1:t - n = rand(Uint32) + n = rand(UInt32) s = hex(n) m = uint32(parseint(Int64,s,16)) end diff --git a/test/perf/shootout/fasta.jl b/test/perf/shootout/fasta.jl index eebeca65e36df..34033eb833ad4 100644 --- a/test/perf/shootout/fasta.jl +++ b/test/perf/shootout/fasta.jl @@ -40,7 +40,7 @@ function choose_char(cs) end function random_fasta(symb, pr, n) cs = cumsum(pr) - line = Array(Uint8, line_width) + line = Array(UInt8, line_width) k = n while k > 0 m = min(k, line_width) diff --git a/test/perf/shootout/mandelbrot.jl b/test/perf/shootout/mandelbrot.jl index f4b3697a050de..b7cc7da751505 100644 --- a/test/perf/shootout/mandelbrot.jl +++ b/test/perf/shootout/mandelbrot.jl @@ -16,7 +16,7 @@ function ismandel(z::Complex128) return true end -function draw_mandel(M::Array{Uint8, 2}, n::Int) +function draw_mandel(M::Array{UInt8, 2}, n::Int) for y = 0:n-1 ci = 2y/n - 1 for x = 0:n-1 @@ -33,7 +33,7 @@ function mandelbrot(n::Int=200, outfile="mandelbrot-output-julia.txt") error("Error: n of $n is not divisible by 8") end - M = zeros(Uint8, div(n, 8), n) + M = zeros(UInt8, div(n, 8), n) draw_mandel(M, n) output = open(outfile, "w") diff --git a/test/perf/shootout/meteor_contest.jl b/test/perf/shootout/meteor_contest.jl index ded3b22cc49fb..3456eddb0de03 100644 --- a/test/perf/shootout/meteor_contest.jl +++ b/test/perf/shootout/meteor_contest.jl @@ -41,14 +41,14 @@ const pieces = ( ) const solutions = Any[] -const masks = zeros(Uint64, 10) +const masks = zeros(UInt64, 10) const masksAtCell = Array(Any, width*height, height) valid(x, y) = (0 <= x < width) && (0 <= y < height) -legal(mask::Uint64, board::Uint64) = (mask & board) == 0 -zerocount(mask::Uint64) = 50 - count_ones(mask) +legal(mask::UInt64, board::UInt64) = (mask & board) == 0 +zerocount(mask::UInt64) = 50 - count_ones(mask) -function findFreeCell(board::Uint64) +function findFreeCell(board::UInt64) for y in 0:height-1 for x in 0:width-1 if board & (uint64(1) << (x + width*y)) == 0 @@ -58,7 +58,7 @@ function findFreeCell(board::Uint64) end end -function floodFill(board::Uint64, fixme) +function floodFill(board::UInt64, fixme) x, y = fixme if !valid(x,y) return board @@ -76,7 +76,7 @@ function floodFill(board::Uint64, fixme) return board end -function noIslands(mask::Uint64) +function noIslands(mask::UInt64) zeroes_ = zerocount(mask) if zeroes_ < 5 @@ -113,7 +113,7 @@ function getBitmask(x, y, piece) end function allBitmasks(piece, color) - bitmasks = Uint64[] + bitmasks = UInt64[] for orientations in 0:1 for rotations in 0:(6 - 3*(color == 4))-1 for y in 0:height-1 @@ -133,7 +133,7 @@ end function generateBitmasks() for i = 1:length(masksAtCell) - masksAtCell[i] = Uint64[] + masksAtCell[i] = UInt64[] end color = 0 @@ -158,7 +158,7 @@ function generateBitmasks() end end -function solveCell(cell_, board::Uint64, n) +function solveCell(cell_, board::UInt64, n) if length(solutions) >= n return end @@ -202,7 +202,7 @@ end function stringOfMasks(masks) s = "" - mask::Uint64 = 1 + mask::UInt64 = 1 for y in 0:height-1 for x in 0:width-1 for color in 0:9 diff --git a/test/perf/shootout/revcomp.jl b/test/perf/shootout/revcomp.jl index 58e9d15eec758..17e1d5ea70713 100644 --- a/test/perf/shootout/revcomp.jl +++ b/test/perf/shootout/revcomp.jl @@ -39,7 +39,7 @@ end function revcomp(infile="revcomp-input.txt") input = open(infile, "r") - buff = Uint8[] + buff = UInt8[] while true line = readline(input).data if isempty(line) @@ -47,7 +47,7 @@ function revcomp(infile="revcomp-input.txt") return elseif line[1] == '>' # print_buff(buff) - buff = Uint8[] + buff = UInt8[] # write(line) else l = length(line)-1 diff --git a/test/pollfd.jl b/test/pollfd.jl index a1d399f50cc37..d57c51981bb45 100644 --- a/test/pollfd.jl +++ b/test/pollfd.jl @@ -26,15 +26,15 @@ function test_read(slval) t = Task(()->test_poll_fd(tval)) sleep(slval) - @test 1 == ccall(:write, Csize_t, (Cint, Ptr{Uint8},Csize_t), pipe_fds[2], bytestring("A"), 1) + @test 1 == ccall(:write, Csize_t, (Cint, Ptr{UInt8},Csize_t), pipe_fds[2], bytestring("A"), 1) tr = consume(t) t_elapsed = toq() @test isreadable(tr) || iswritable(tr) - dout = Array(Uint8, 1) - @test 1 == ccall(:read, Csize_t, (Cint, Ptr{Uint8},Csize_t), pipe_fds[1], dout, 1) + dout = Array(UInt8, 1) + @test 1 == ccall(:read, Csize_t, (Cint, Ptr{UInt8},Csize_t), pipe_fds[1], dout, 1) @test dout[1] == int8('A') @test slval <= t_elapsed diff --git a/test/random.jl b/test/random.jl index 9b549d27a856f..9271c49981087 100644 --- a/test/random.jl +++ b/test/random.jl @@ -4,7 +4,7 @@ srand(0); rand(); x = rand(384); @test rand() != rand() @test 0.0 <= rand() < 1.0 -@test rand(Uint32) >= 0 +@test rand(UInt32) >= 0 @test -10 <= rand(-10:-5) <= -5 @test -10 <= rand(-10:5) <= 5 @test minimum([rand(int32(1):int32(7^7)) for i = 1:100000]) > 0 @@ -38,7 +38,7 @@ randn!(MersenneTwister(42), A) @test A == [-0.5560268761463861 0.027155338009193845; -0.444383357109696 -0.29948409035891055] -for T in (Int8, Uint8, Int16, Uint16, Int32, Uint32, Int64, Uint64, Int128, Uint128, +for T in (Int8, UInt8, Int16, UInt16, Int32, UInt32, Int64, UInt64, Int128, UInt128, Float16, Float32, Float64, Rational{Int}) r = rand(convert(T, 97):convert(T, 122)) @test typeof(r) == T @@ -78,11 +78,11 @@ emantissa = int64(2)^52 ziggurat_exp_r = BigFloat("7.69711747013104971404462804811408952334296818528283253278834867283241051210533") exp_section_area = (ziggurat_exp_r + 1)*exp(-ziggurat_exp_r) -const ki = Array(Uint64, ziggurat_table_size) +const ki = Array(UInt64, ziggurat_table_size) const wi = Array(Float64, ziggurat_table_size) const fi = Array(Float64, ziggurat_table_size) # Tables for exponential variates -const ke = Array(Uint64, ziggurat_table_size) +const ke = Array(UInt64, ziggurat_table_size) const we = Array(Float64, ziggurat_table_size) const fe = Array(Float64, ziggurat_table_size) function randmtzig_fill_ziggurat_tables() # Operates on the global arrays @@ -136,7 +136,7 @@ function randmtzig_fill_ziggurat_tables() # Operates on the global arrays feb[i] = exp(-x) x1 = x end - ke[2] = zero(Uint64) + ke[2] = zero(UInt64) wi[:] = float64(wib) fi[:] = float64(fib) @@ -154,7 +154,7 @@ randmtzig_fill_ziggurat_tables() #same random numbers on for small ranges on all systems -seed = rand(Uint) #leave state nondeterministic as above +seed = rand(UInt) #leave state nondeterministic as above srand(seed) r = int64(rand(int32(97:122))) srand(seed) diff --git a/test/ranges.jl b/test/ranges.jl index 1a87f90b87497..f1517ec7fbdc7 100644 --- a/test/ranges.jl +++ b/test/ranges.jl @@ -152,7 +152,7 @@ let s = 0 # loops covering the full range of smaller integer types s = 0 - for i = typemin(Uint8):typemax(Uint8) + for i = typemin(UInt8):typemax(UInt8) s += 1 end @test s == 256 @@ -160,12 +160,12 @@ let s = 0 # loops past typemax(Int) n = 0 s = int128(0) - for i = typemax(Uint64)-2:typemax(Uint64) + for i = typemax(UInt64)-2:typemax(UInt64) n += 1 s += i end @test n == 3 - @test s == 3*int128(typemax(Uint64)) - 3 + @test s == 3*int128(typemax(UInt64)) - 3 # loops over empty ranges s = 0 @@ -302,8 +302,8 @@ for s in 3:100 end @test length(uint(1):uint(1):uint(0)) == 0 -@test length(typemax(Uint):uint(1):(typemax(Uint)-1)) == 0 -@test length(typemax(Uint):uint(2):(typemax(Uint)-1)) == 0 +@test length(typemax(UInt):uint(1):(typemax(UInt)-1)) == 0 +@test length(typemax(UInt):uint(2):(typemax(UInt)-1)) == 0 @test length((typemin(Int)+3):5:(typemin(Int)+1)) == 0 # issue #6364 @@ -366,8 +366,8 @@ end # issue #8531 let smallint = (Int === Int64 ? - (Int8,Uint8,Int16,Uint16,Int32,Uint32) : - (Int8,Uint8,Int16,Uint16)) + (Int8,UInt8,Int16,UInt16,Int32,UInt32) : + (Int8,UInt8,Int16,UInt16)) for T in smallint @test length(typemin(T):typemax(T)) == 2^(8*sizeof(T)) end diff --git a/test/reducedim.jl b/test/reducedim.jl index 42031c2a95f1d..ab6ba2007915a 100644 --- a/test/reducedim.jl +++ b/test/reducedim.jl @@ -51,7 +51,7 @@ r = fill(NaN, Base.reduced_dims(size(Breduc), 1)) # Small integers @test @inferred(sum(Int8[1], 1)) == [1] -@test @inferred(sum(Uint8[1], 1)) == [1] +@test @inferred(sum(UInt8[1], 1)) == [1] # Complex types @test typeof(@inferred(sum([1.0+1.0im], 1))) == Vector{Complex128} diff --git a/test/repl.jl b/test/repl.jl index 4a15febc40f0c..f82f58edcdbb8 100644 --- a/test/repl.jl +++ b/test/repl.jl @@ -190,7 +190,7 @@ rc != 0 && error("grantpt failed") rc = ccall(:unlockpt,Cint,(Cint,),fdm) rc != 0 && error("unlockpt") -fds = ccall(:open,Cint,(Ptr{Uint8},Cint),ccall(:ptsname,Ptr{Uint8},(Cint,),fdm), O_RDWR|O_NOCTTY) +fds = ccall(:open,Cint,(Ptr{UInt8},Cint),ccall(:ptsname,Ptr{UInt8},(Cint,),fdm), O_RDWR|O_NOCTTY) # slave slave = RawFD(fds) diff --git a/test/show.jl b/test/show.jl index 5e6b67f672e41..fde527e9a750f 100644 --- a/test/show.jl +++ b/test/show.jl @@ -72,7 +72,7 @@ end # control structures (shamelessly stolen from base/bitarray.jl) @test_repr """type BitArray{N} <: AbstractArray{Bool, N} - chunks::Vector{Uint64} + chunks::Vector{UInt64} len::Int dims::NTuple{N,Int} function BitArray(dims::Int...) @@ -87,7 +87,7 @@ end n *= d end nc = num_bit_chunks(n) - chunks = Array(Uint64, nc) + chunks = Array(UInt64, nc) if nc > 0 chunks[end] = uint64(0) end @@ -99,7 +99,7 @@ end end end""" -@test_repr """function copy_chunks(dest::Vector{Uint64}, pos_d::Integer, src::Vector{Uint64}, pos_s::Integer, numbits::Integer) +@test_repr """function copy_chunks(dest::Vector{UInt64}, pos_d::Integer, src::Vector{UInt64}, pos_s::Integer, numbits::Integer) if numbits == 0 return end diff --git a/test/socket.jl b/test/socket.jl index f6aa22a800a84..b431ef138e7ba 100644 --- a/test/socket.jl +++ b/test/socket.jl @@ -11,7 +11,7 @@ @test_throws ErrorException Base.parseipv4("192.") @test ip"::1" == IPv6(1) -@test ip"2605:2700:0:3::4713:93e3" == IPv6(parseint(Uint128,"260527000000000300000000471393e3",16)) +@test ip"2605:2700:0:3::4713:93e3" == IPv6(parseint(UInt128,"260527000000000300000000471393e3",16)) @test ip"2001:db8:0:0:0:0:2:1" == ip"2001:db8::2:1" == ip"2001:db8::0:2:1" diff --git a/test/sorting.jl b/test/sorting.jl index 138a330ed8bba..e170c6215ea23 100644 --- a/test/sorting.jl +++ b/test/sorting.jl @@ -123,7 +123,7 @@ b = sort(a, alg=QuickSort, by=x->1/x) ## more advanced sorting tests ## -randnans(n) = reinterpret(Float64,[rand(Uint64)|0x7ff8000000000000 for i=1:n]) +randnans(n) = reinterpret(Float64,[rand(UInt64)|0x7ff8000000000000 for i=1:n]) function randn_with_nans(n,p) v = randn(n) @@ -186,14 +186,14 @@ for n in [0:10, 100, 101, 1000, 1001] # test float sorting with NaNs s = sort(v, alg=alg, rev=rev) @test issorted(s, rev=rev) - @test reinterpret(Uint64,v[isnan(v)]) == reinterpret(Uint64,s[isnan(s)]) + @test reinterpret(UInt64,v[isnan(v)]) == reinterpret(UInt64,s[isnan(s)]) # test float permutation with NaNs p = sortperm(v, alg=alg, rev=rev) @test isperm(p) vp = v[p] @test isequal(vp,s) - @test reinterpret(Uint64,vp) == reinterpret(Uint64,s) + @test reinterpret(UInt64,vp) == reinterpret(UInt64,s) end end diff --git a/test/sparse.jl b/test/sparse.jl index f0073994bf871..509986a9aff7e 100644 --- a/test/sparse.jl +++ b/test/sparse.jl @@ -300,8 +300,8 @@ for (aa116, ss116) in [(a116, s116), (ad116, sd116)] end # workaround issue #7197: comment out let-block -#let S = SparseMatrixCSC(3, 3, Uint8[1,1,1,1], Uint8[], Int64[]) -S1290 = SparseMatrixCSC(3, 3, Uint8[1,1,1,1], Uint8[], Int64[]) +#let S = SparseMatrixCSC(3, 3, UInt8[1,1,1,1], UInt8[], Int64[]) +S1290 = SparseMatrixCSC(3, 3, UInt8[1,1,1,1], UInt8[], Int64[]) S1290[1,1] = 1 S1290[5] = 2 S1290[end] = 3 diff --git a/test/statistics.jl b/test/statistics.jl index e3fae25434f50..94aca0c2d3872 100644 --- a/test/statistics.jl +++ b/test/statistics.jl @@ -6,7 +6,7 @@ @test middle([1:8]) === 4.5 # ensure type-correctness -for T in [Bool,Int8,Int16,Int32,Int64,Int128,Uint8,Uint16,Uint32,Uint64,Uint128,Float16,Float32,Float64] +for T in [Bool,Int8,Int16,Int32,Int64,Int128,UInt8,UInt16,UInt32,UInt64,UInt128,Float16,Float32,Float64] @test middle(one(T)) === middle(one(T), one(T)) end diff --git a/test/strings.jl b/test/strings.jl index 4d6eb8d9549fd..a99fd27dfda91 100644 --- a/test/strings.jl +++ b/test/strings.jl @@ -52,7 +52,7 @@ cx = Any[ ] for i = 1:size(cx,1) - @test cx[i,1] == convert(Uint32, cx[i,2]) + @test cx[i,1] == convert(UInt32, cx[i,2]) @test string(cx[i,2]) == unescape_string(cx[i,3]) if isascii(cx[i,2]) || !isprint(cx[i,2]) @test cx[i,3] == escape_string(string(cx[i,2])) @@ -237,7 +237,7 @@ for T in (Int8, Int16, Int32, Int64) @test_throws OverflowError parseint(T,string(big(typemax(T))+1)) end -for T in (Uint8,Uint16,Uint32,Uint64) +for T in (UInt8,UInt16,UInt32,UInt64) @test parseint(T,string(typemin(T))) == typemin(T) @test parseint(T,string(typemax(T))) == typemax(T) @test_throws ErrorException parseint(T,string(big(typemin(T))-1)) @@ -475,8 +475,8 @@ end @test rsearch("foo,bar,baz", "az", 10) == 0:-1 # array rsearch -@test rsearch(Uint8[1,2,3],Uint8[2,3],3) == 2:3 -@test rsearch(Uint8[1,2,3],Uint8[2,3],1) == 0:-1 +@test rsearch(UInt8[1,2,3],UInt8[2,3],3) == 2:3 +@test rsearch(UInt8[1,2,3],UInt8[2,3],1) == 0:-1 # string search with a two-char regex @test search("foo,bar,baz", r"xx") == 0:-1 @@ -834,7 +834,7 @@ bin_val = hex2bytes(hex_str) bin_val = hex2bytes("07bf") @test bin_val[1] == 7 @test bin_val[2] == 191 -@test typeof(bin_val) == Array{Uint8, 1} +@test typeof(bin_val) == Array{UInt8, 1} @test length(bin_val) == 2 # all valid hex chars @@ -917,7 +917,7 @@ bin_val = hex2bytes("07bf") @test float(SubString("1 0",1,1)) === 1.0 @test float32(SubString("10",1,1)) === 1.0f0 -for T = (Uint8,Int8,Uint16,Int16,Uint32,Int32,Uint64,Int64,Uint128,Int128,BigInt), +for T = (UInt8,Int8,UInt16,Int16,UInt32,Int32,UInt64,Int64,UInt128,Int128,BigInt), b = 2:62, _ = 1:10 n = T != BigInt ? rand(T) : BigInt(rand(Int128)) @test parseint(T,base(b,n),b) == n diff --git a/test/unicode.jl b/test/unicode.jl index 4b71c8dc49ff2..9e9648034eb02 100644 --- a/test/unicode.jl +++ b/test/unicode.jl @@ -6,7 +6,7 @@ u16 = utf16(u8) @test length(u16) == 4 @test utf8(u16) == u8 @test collect(u8) == collect(u16) -@test u8 == utf16(u16.data[1:end-1]) == utf16(copy!(Array(Uint8, 14), 1, reinterpret(Uint8, u16.data), 1, 14)) +@test u8 == utf16(u16.data[1:end-1]) == utf16(copy!(Array(UInt8, 14), 1, reinterpret(UInt8, u16.data), 1, 14)) @test u8 == utf16(pointer(u16)) == utf16(convert(Ptr{Int16}, pointer(u16))) # UTF32 @@ -16,7 +16,7 @@ u32 = utf32(u8) @test length(u32) == 4 @test utf8(u32) == u8 @test collect(u8) == collect(u32) -@test u8 == utf32(u32.data[1:end-1]) == utf32(copy!(Array(Uint8, 16), 1, reinterpret(Uint8, u32.data), 1, 16)) +@test u8 == utf32(u32.data[1:end-1]) == utf32(copy!(Array(UInt8, 16), 1, reinterpret(UInt8, u32.data), 1, 16)) @test u8 == utf32(pointer(u32)) == utf32(convert(Ptr{Int32}, pointer(u32))) # Wstring @@ -50,30 +50,30 @@ else end f=open(joinpath(unicodedir,"UTF-32LE.unicode")) - str1 = utf32(read(f, Uint32, 1112065)[2:end]) + str1 = utf32(read(f, UInt32, 1112065)[2:end]) close(f) f=open(joinpath(unicodedir,"UTF-8.unicode")) - str2 = UTF8String(read(f, Uint8, 4382595)[4:end]) + str2 = UTF8String(read(f, UInt8, 4382595)[4:end]) close(f) @test str1 == str2 @test str1 == open(joinpath(unicodedir,"UTF-16LE.unicode")) do f - utf16(read(f, Uint16, 2160641)[2:end]) + utf16(read(f, UInt16, 2160641)[2:end]) end @test str1 == open(joinpath(unicodedir,"UTF-16LE.unicode")) do f - utf16(read(f, Uint8, 2160641*2)) + utf16(read(f, UInt8, 2160641*2)) end @test str1 == open(joinpath(unicodedir,"UTF-16BE.unicode")) do f - utf16(read(f, Uint8, 2160641*2)) + utf16(read(f, UInt8, 2160641*2)) end @test str1 == open(joinpath(unicodedir,"UTF-32LE.unicode")) do f - utf32(read(f, Uint8, 1112065*4)) + utf32(read(f, UInt8, 1112065*4)) end @test str1 == open(joinpath(unicodedir,"UTF-32BE.unicode")) do f - utf32(read(f, Uint8, 1112065*4)) + utf32(read(f, UInt8, 1112065*4)) end str1 = "∀ ε > 0, ∃ δ > 0: |x-y| < δ ⇒ |f(x)-f(y)| < ε"