X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;ds=sidebyside;f=helm%2Fsoftware%2Fmatita%2Fcontribs%2Fng_assembly%2Fnum%2Fexadecim.ma;h=1951578a4e656ce477c48f2843eaba6f37649f83;hb=e880d6eab5e1700f4a625ddcd7d0fa8f0cce2dcc;hp=6face1d211f9fbe30ea50d11b0c7592413dd3ee0;hpb=6ee4fa0ba5f4b6601b62afd482d4f30bd2de2f91;p=helm.git diff --git a/helm/software/matita/contribs/ng_assembly/num/exadecim.ma b/helm/software/matita/contribs/ng_assembly/num/exadecim.ma index 6face1d21..1951578a4 100755 --- a/helm/software/matita/contribs/ng_assembly/num/exadecim.ma +++ b/helm/software/matita/contribs/ng_assembly/num/exadecim.ma @@ -688,6 +688,13 @@ ndefinition setMSB_ex ≝ | x8 ⇒ x8 | x9 ⇒ x9 | xA ⇒ xA | xB ⇒ xB | xC ⇒ xC | xD ⇒ xD | xE ⇒ xE | xF ⇒ xF ]. +ndefinition clrMSB_ex ≝ +λe:exadecim.match e with + [ x0 ⇒ x0 | x1 ⇒ x1 | x2 ⇒ x2 | x3 ⇒ x3 + | x4 ⇒ x4 | x5 ⇒ x5 | x6 ⇒ x6 | x7 ⇒ x7 + | x8 ⇒ x0 | x9 ⇒ x1 | xA ⇒ x2 | xB ⇒ x3 + | xC ⇒ x4 | xD ⇒ x5 | xE ⇒ x6 | xF ⇒ x7 ]. + (* operatore Least Significant Bit *) ndefinition getLSB_ex ≝ λe:exadecim.match e with @@ -703,6 +710,13 @@ ndefinition setLSB_ex ≝ | x8 ⇒ x9 | x9 ⇒ x9 | xA ⇒ xB | xB ⇒ xB | xC ⇒ xD | xD ⇒ xD | xE ⇒ xF | xF ⇒ xF ]. +ndefinition clrLSB_ex ≝ +λe:exadecim.match e with + [ x0 ⇒ x0 | x1 ⇒ x0 | x2 ⇒ x2 | x3 ⇒ x2 + | x4 ⇒ x4 | x5 ⇒ x4 | x6 ⇒ x6 | x7 ⇒ x6 + | x8 ⇒ x8 | x9 ⇒ x8 | xA ⇒ xA | xB ⇒ xA + | xC ⇒ xC | xD ⇒ xC | xE ⇒ xE | xF ⇒ xE ]. + (* operatore rotazione destra con carry *) ndefinition rcr_ex ≝ λc:bool.λe:exadecim.match c with @@ -1392,6 +1406,11 @@ ndefinition compl_ex ≝ | x8 ⇒ x8 | x9 ⇒ x7 | xA ⇒ x6 | xB ⇒ x5 | xC ⇒ x4 | xD ⇒ x3 | xE ⇒ x2 | xF ⇒ x1 ]. +(* operatore abs *) +ndefinition abs_ex ≝ +λe:exadecim.match getMSB_ex e with + [ true ⇒ compl_ex e | false ⇒ e ]. + (* operatore x in [inf,sup] o in sup],[inf *) ndefinition inrange_ex ≝ λx,inf,sup:exadecim. @@ -1434,3 +1453,15 @@ ndefinition ex_of_qu ≝ ndefinition ex_of_oct ≝ λn.match n with [ o0 ⇒ x0 | o1 ⇒ x1 | o2 ⇒ x2 | o3 ⇒ x3 | o4 ⇒ x4 | o5 ⇒ x5 | o6 ⇒ x6 | o7 ⇒ x7 ]. + +(* esadecimali xNNNN → ottali *) +ndefinition oct_of_exL ≝ +λn.match n with + [ x0 ⇒ o0 | x1 ⇒ o1 | x2 ⇒ o2 | x3 ⇒ o3 | x4 ⇒ o4 | x5 ⇒ o5 | x6 ⇒ o6 | x7 ⇒ o7 + | x8 ⇒ o0 | x9 ⇒ o1 | xA ⇒ o2 | xB ⇒ o3 | xC ⇒ o4 | xD ⇒ o5 | xE ⇒ o6 | xF ⇒ o7 ]. + +(* esadecimali NNNNx → ottali *) +ndefinition oct_of_exH ≝ +λn.match n with + [ x0 ⇒ o0 | x1 ⇒ o0 | x2 ⇒ o1 | x3 ⇒ o1 | x4 ⇒ o2 | x5 ⇒ o2 | x6 ⇒ o3 | x7 ⇒ o3 + | x8 ⇒ o4 | x9 ⇒ o4 | xA ⇒ o5 | xB ⇒ o5 | xC ⇒ o6 | xD ⇒ o6 | xE ⇒ o7 | xF ⇒ o7 ].