[latex3-commits] [git/LaTeX3-latex3-latex3] l3bitset: handle negative indices ... (cbcdf436e)

Ulrike Fischer fischer at troubleshooting-tex.de
Thu Dec 17 16:07:49 CET 2020


Repository : https://github.com/latex3/latex3
On branch  : l3bitset
Link       : https://github.com/latex3/latex3/commit/cbcdf436e411e627757ed4d8176f3eb91e2aa60c

>---------------------------------------------------------------

commit cbcdf436e411e627757ed4d8176f3eb91e2aa60c
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Thu Dec 17 16:07:49 2020 +0100

    handle negative indices ...


>---------------------------------------------------------------

cbcdf436e411e627757ed4d8176f3eb91e2aa60c
 l3kernel/l3bitset.dtx | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/l3kernel/l3bitset.dtx b/l3kernel/l3bitset.dtx
index 62e7ceda7..8e951fb66 100644
--- a/l3kernel/l3bitset.dtx
+++ b/l3kernel/l3bitset.dtx
@@ -404,9 +404,15 @@
 %   }
 %    \begin{macrocode}
 \cs_new:Npn \bitset_index:Nn #1 #2
- {
-   \int_eval:n { \str_item:Nn #1 { 0 - (#2)} + 0 }
- }
+  {
+    \int_compare:nNnTF { #2 } > { 0 }
+      {
+        \int_eval:n { \str_item:Nn #1 { 0 - (#2)} + 0 }
+      }
+      {
+        0
+      }
+  }
 \cs_generate_variant:Nn \bitset_index:Nn {cn}
 %    \end{macrocode}
 % \end{macro}





More information about the latex3-commits mailing list.