diff options
author | Karl Berry <karl@freefriends.org> | 2021-05-25 20:48:22 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-05-25 20:48:22 +0000 |
commit | 1764edc3b60a2c9fb210ca74b758f3e8e8a53692 (patch) | |
tree | da1842e54bdea33c2b8d434860131cfa08c9444d /Master/texmf-dist/source/latex/l3kernel/l3int.dtx | |
parent | 4bf5956529386575d89874638bfd567040b9475c (diff) |
l3kernel (25may21)
git-svn-id: svn://tug.org/texlive/trunk@59345 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3int.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3int.dtx | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx index 5994a193c6c..505afcd9ee4 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2021-05-11} +% \date{Released 2021-05-25} % % \maketitle % @@ -1088,13 +1088,14 @@ % % \begin{macro}{\int_eval:n} % \begin{macro}{\int_eval:w} -% Wrapper for \cs{@@_eval:w}: can be used in an integer expression -% or directly in the input stream. -% When debugging, use parentheses to catch early termination. +% Wrapper for \cs{@@_eval:w}: can be used in an integer expression or +% directly in the input stream. It is very slightly faster to use +% \tn{the} rather than \tn{number} to turn the expression to a number. +% When debugging, we introduce parentheses to catch early termination (see \pkg{l3debug}). % \begin{macrocode} \cs_new:Npn \int_eval:n #1 - { \int_value:w \@@_eval:w #1 \@@_eval_end: } -\cs_new:Npn \int_eval:w { \int_value:w \@@_eval:w } + { \tex_the:D \@@_eval:w #1 \@@_eval_end: } +\cs_new:Npn \int_eval:w { \tex_the:D \@@_eval:w } % \end{macrocode} % \end{macro} % \end{macro} @@ -1399,15 +1400,17 @@ % \begin{macro}{\int_gsub:Nn, \int_gsub:cn} % \UnitTested % Adding and subtracting to and from a counter. +% Including here the optional |by| would slow down these operations +% by a few percent. % \begin{macrocode} \cs_new_protected:Npn \int_add:Nn #1#2 - { \tex_advance:D #1 by \@@_eval:w #2 \@@_eval_end: } + { \tex_advance:D #1 \@@_eval:w #2 \@@_eval_end: } \cs_new_protected:Npn \int_sub:Nn #1#2 - { \tex_advance:D #1 by - \@@_eval:w #2 \@@_eval_end: } + { \tex_advance:D #1 - \@@_eval:w #2 \@@_eval_end: } \cs_new_protected:Npn \int_gadd:Nn #1#2 - { \tex_global:D \tex_advance:D #1 by \@@_eval:w #2 \@@_eval_end: } + { \tex_global:D \tex_advance:D #1 \@@_eval:w #2 \@@_eval_end: } \cs_new_protected:Npn \int_gsub:Nn #1#2 - { \tex_global:D \tex_advance:D #1 by - \@@_eval:w #2 \@@_eval_end: } + { \tex_global:D \tex_advance:D #1 - \@@_eval:w #2 \@@_eval_end: } \cs_generate_variant:Nn \int_add:Nn { c } \cs_generate_variant:Nn \int_gadd:Nn { c } \cs_generate_variant:Nn \int_sub:Nn { c } @@ -1452,12 +1455,14 @@ % \begin{macro}{\int_gset:Nn, \int_gset:cn} % \UnitTested % As integers are register-based \TeX{} issues an error -% if they are not defined. +% if they are not defined. While the |=| sign is optional, this +% version with |=| is slightly quicker than without, while adding the +% optional space after |=| slows things down minutely. % \begin{macrocode} \cs_new_protected:Npn \int_set:Nn #1#2 - { #1 ~ \@@_eval:w #2 \@@_eval_end: } + { #1 = \@@_eval:w #2 \@@_eval_end: } \cs_new_protected:Npn \int_gset:Nn #1#2 - { \tex_global:D #1 ~ \@@_eval:w #2 \@@_eval_end: } + { \tex_global:D #1 = \@@_eval:w #2 \@@_eval_end: } \cs_generate_variant:Nn \int_set:Nn { c } \cs_generate_variant:Nn \int_gset:Nn { c } % \end{macrocode} @@ -1468,13 +1473,10 @@ % % \begin{macro}{\int_use:N, \int_use:c} % \UnitTested -% Here is how counters are accessed: +% Here is how counters are accessed. +% We hand-code the |c| variant for some speed gain. % \begin{macrocode} \cs_new_eq:NN \int_use:N \tex_the:D -% \end{macrocode} -% We hand-code this for some speed gain: -% \begin{macrocode} -%\cs_generate_variant:Nn \int_use:N { c } \cs_new:Npn \int_use:c #1 { \tex_the:D \cs:w #1 \cs_end: } % \end{macrocode} % \end{macro} |