diff --git a/j/env.j b/j/env.j index 2262d11ebdffb..228b5211f43cb 100644 --- a/j/env.j +++ b/j/env.j @@ -53,11 +53,10 @@ has(::EnvHash, k::String) = hasenv(k) del(::EnvHash, k::String) = unsetenv(k) assign(::EnvHash, v::String, k::String) = (setenv(k,v); v) -start(::EnvHash) = int32(0) +start(::EnvHash) = 0 done(::EnvHash, i) = (ccall(:jl_environ, Any, (Int32,), int32(i)) == nothing) function next(::EnvHash, i) - i = int32(i) - env = ccall(:jl_environ, Any, (Int32,), i) + env = ccall(:jl_environ, Any, (Int32,), int32(i)) if env == nothing error("environ: index out of range") end @@ -66,7 +65,7 @@ function next(::EnvHash, i) if m == nothing error("malformed environment entry: $env") end - (m.captures, i+one(i)) + (m.captures, i+1) end function show(::EnvHash) diff --git a/j/int.j b/j/int.j index 24ec123567503..7bc3346a10eb6 100644 --- a/j/int.j +++ b/j/int.j @@ -182,7 +182,7 @@ promote_rule(::Type{Uint64}, ::Type{Int64}) = Uint64 # LOSSY -(x::Uint8 ) = boxsi16(neg_int(zext16(unbox8 (x)))) -(x::Uint16) = boxsi32(neg_int(zext32(unbox16(x)))) -(x::Uint32) = boxsi64(neg_int(zext64(unbox32(x)))) --(x::Uint64) = boxsi64(neg_int(unbox64(x))) # LOSSY +-(x::Uint64) = boxui64(neg_int(unbox64(x))) # LOSSY +(x::Int8 , y::Int8 ) = boxsi8 (add_int(unbox8 (x), unbox8 (y))) +(x::Int16, y::Int16) = boxsi16(add_int(unbox16(x), unbox16(y))) diff --git a/j/sparse.j b/j/sparse.j index c653ab422a3bc..38891ef201d54 100644 --- a/j/sparse.j +++ b/j/sparse.j @@ -228,7 +228,7 @@ end function istril{T}(A::SparseMatrixCSC{T}) for col = 1:A.n for i = A.colptr[col]:(A.colptr[col]-1) - if A.rowval[i] < col && A.nzval[i] != zero(T); return false; end + if A.rowval[i] < col && A.nzval[i] != 0; return false; end end end return true @@ -237,7 +237,7 @@ end function istriu{T}(A::SparseMatrixCSC{T}) for col = 1:A.n for i = A.colptr[col]:(A.colptr[col]-1) - if A.rowval[i] > col && A.nzval[i] != zero(T); return false; end + if A.rowval[i] > col && A.nzval[i] != 0; return false; end end end return true @@ -512,7 +512,7 @@ function assign{T,T_int}(A::SparseMatrixCSC{T,T_int}, v, i0::Integer, i1::Intege i1 = convert(T_int, i1) if i0 < 1 || i0 > A.m || i1 < 1 || i1 > A.n; error("assign: index out of bounds"); end v = convert(T, v) - if v == zero(T) #either do nothing or delete entry if it exists + if v == 0 #either do nothing or delete entry if it exists first = A.colptr[i1] last = A.colptr[i1+1]-1 loc = -1 @@ -884,7 +884,7 @@ assign{T,N}(S::SparseAccumulator{T}, v::AbstractArray{T,N}, i::Integer) = invoke(assign, (SparseAccumulator{T}, Any, Integer), S, v, i) function assign{T}(S::SparseAccumulator{T}, v, i::Integer) - if v == zero(T) + if v == 0 if S.flags[i] S.vals[i] = v S.flags[i] = false diff --git a/j/string.j b/j/string.j index adac4113bb8f1..860a4ff168b1a 100644 --- a/j/string.j +++ b/j/string.j @@ -831,9 +831,16 @@ function ndigits(n::Integer, b::Integer) return nd end -function int2str(n::Integer, b::Integer) +int2str(n::Integer, b::Integer) = int2str(int64(n), b) + +function int2str(n::Union(Int64,Uint64), b::Integer) if b < 2 || b > 40; error("int2str: invalid base ", b); end - neg = n