Hi,

I uploaded a new lmtx ... not much done due to the heat (entered reading mode instead) but ... apart from some work in progress ... we now have some basic bitwise operations (maybe we need some more). So far we have:

\startlines
\meaning\bitwiseset
\meaning\bitwisenot
\meaning\bitwisenil
\meaning\bitwiseand
\meaning\bitwiseor
\meaning\bitwisexor
\meaning\ifbitwiseand
\stoplines

used as:

\scratchcounter = \bitwiseand "01 "02 \uchexnumbers{\scratchcounter} \quad \scratchcounter = \bitwiseand "01 with "02 \uchexnumbers{\scratchcounter} \quad \scratchcounter = \bitwiseand "03 "02 \uchexnumbers{\scratchcounter} \par

\scratchcounter = \bitwiseor "01 "02 \uchexnumbers{\scratchcounter} \quad \scratchcounter = \bitwiseor "01 with "02 \uchexnumbers{\scratchcounter} \quad \scratchcounter = \bitwiseor "03 "02 \uchexnumbers{\scratchcounter} \par

\scratchcounter = \bitwisexor "01 "02 \uchexnumbers{\scratchcounter} \quad \scratchcounter = \bitwisexor "01 with "02 \uchexnumbers{\scratchcounter} \quad \scratchcounter = \bitwisexor "03 "02 \uchexnumbers{\scratchcounter} \par

\scratchcounter = \bitwisenil \bitwisenil "0F "02 "01 \uchexnumbers{\scratchcounter} \par \scratchcounter = \bitwisenil \bitwisenil "0F with "02 with "01 \uchexnumbers{\scratchcounter} \par

\scratchcounterone\zerocount

\scratchcounterone \bitwiseset "FFFFFFF
\ifbitwiseand      \scratchcounterone "8000000 YES \else NOP \fi
\ifbitwiseand      \scratchcounterone "F000000 YES \else NOP \fi
\ifbitwiseand      \scratchcounterone "1000000 YES \else NOP \fi
\scratchcounterone \bitwisenot \scratchcounterone
\ifbitwiseand      \scratchcounterone "8000000 YES \else NOP \fi
\ifbitwiseand      \scratchcounterone "F000000 YES \else NOP \fi
\ifbitwiseand      \scratchcounterone "1000000 YES \else NOP \fi

\scratchcounter \bitwiseand "01 "02
\scratchcounter \numexpr    "01+"02\relax

\ifcase      \bitwiseand \scratchcounterone \plusone \else \fi
\ifbitwiseand            \scratchcounterone \plusone \else \fi
\ifnum                   \scratchcounterone=\plusone \else \fi

A while ago I played with bitwise operator sin \numexpr but in the end removed that because it's messy with the symbols to be used, but I will look at that agaon if needed.

Hans



-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
       tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to