File tree 2 files changed +8
-0
lines changed
2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -327,6 +327,8 @@ rem{T<:Integer}(x::T, ::Type{T}) = x
327
327
rem (x:: Integer , :: Type{Bool} ) = ((x& 1 )!= 0 )
328
328
mod {T<:Integer} (x:: Integer , :: Type{T} ) = rem (x, T)
329
329
330
+ unsafe_trunc {T<:Integer} (:: Type{T} , x:: Integer ) = rem (x, T)
331
+
330
332
convert {Tf<:Union{Float32,Float64}} (T:: BitSigned64T , x:: Tf ) =
331
333
box (T,checked_fptosi (T,unbox (Tf,x)))
332
334
convert {Tf<:Union{Float32,Float64}} (T:: BitUnsigned64T , x:: Tf ) =
Original file line number Diff line number Diff line change 195
195
@test true << 2 === 1 << 2
196
196
@test true >> 2 === 1 >> 2
197
197
@test true >>> 2 === 1 >>> 2
198
+
199
+ @test @inferred (unsafe_trunc (Int8, 127 )) === Int8 (127 )
200
+ @test unsafe_trunc (Int8, 128 ) === Int8 (- 128 )
201
+ @test unsafe_trunc (Int8, - 127 ) === Int8 (- 127 )
202
+ @test unsafe_trunc (Int8, - 128 ) === Int8 (- 128 )
203
+ @test unsafe_trunc (Int8, - 129 ) === Int8 (127 )
You can’t perform that action at this time.
0 commit comments