|
1 | 1 | import Base.@deprecate_binding |
2 | | - |
3 | | -@deprecate_binding Fixed16 Q15f16 |
4 | | -@deprecate_binding UFixed8 N0f8 |
5 | | -@deprecate_binding UFixed10 N6f10 |
6 | | -@deprecate_binding UFixed12 N4f12 |
7 | | -@deprecate_binding UFixed14 N2f14 |
8 | | -@deprecate_binding UFixed16 N0f16 |
9 | | - |
10 | | -@deprecate_binding UfixedBase Normed |
11 | | -@deprecate_binding Ufixed Normed |
12 | | -@deprecate_binding UFixed Normed |
13 | | -@deprecate_binding Ufixed8 N0f8 |
14 | | -@deprecate_binding Ufixed10 N6f10 |
15 | | -@deprecate_binding Ufixed12 N4f12 |
16 | | -@deprecate_binding Ufixed14 N2f14 |
17 | | -@deprecate_binding Ufixed16 N0f16 |
18 | | - |
19 | | -@deprecate_binding Fixed32 Q15f16 |
20 | | - |
21 | | -const UF = (N0f8, N6f10, N4f12, N2f14, N0f16) |
22 | | - |
23 | | -@deprecate Fixed(x::Real) convert(Fixed{Int32, 16}, x) |
24 | | - |
25 | | -@deprecate ufixed8(x) N0f8(x) |
26 | | -@deprecate ufixed10(x) N6f10(x) |
27 | | -@deprecate ufixed12(x) N4f12(x) |
28 | | -@deprecate ufixed14(x) N2f14(x) |
29 | | -@deprecate ufixed16(x) N0f16(x) |
30 | | - |
31 | | -## The next lines mimic the floating-point literal syntax "3.2f0" |
32 | | -# construction using a UInt, i.e., 0xccuf8 |
33 | | -struct NormedConstructor{T,f} end |
34 | | -function *(n::Integer, ::NormedConstructor{T,f}) where {T,f} |
35 | | - i = 8*sizeof(T)-f |
36 | | - io = IOBuffer() |
37 | | - show(io, n) |
38 | | - nstr = String(take!(io)) |
39 | | - cstr = typeof(n) == T ? nstr : "convert($T, $nstr)" |
40 | | - Base.depwarn("$(nstr)uf$f is deprecated, please use reinterpret(N$(i)f$f, $cstr) instead", :*) |
41 | | - reinterpret(Normed{T,f}, convert(T, n)) |
42 | | -end |
43 | | -const uf8 = NormedConstructor{UInt8,8}() |
44 | | -const uf10 = NormedConstructor{UInt16,10}() |
45 | | -const uf12 = NormedConstructor{UInt16,12}() |
46 | | -const uf14 = NormedConstructor{UInt16,14}() |
47 | | -const uf16 = NormedConstructor{UInt16,16}() |
48 | | - |
49 | | -@deprecate_binding UfixedConstructor NormedConstructor |
50 | | -@deprecate_binding UFixedConstructor NormedConstructor |
0 commit comments