[latex3-commits] [git/LaTeX3-latex3-latex3] master: Simplify l3fparray storage of special values (33b0a51)
Bruno Le Floch
bruno at le-floch.fr
Sun May 6 18:56:23 CEST 2018
Repository : https://github.com/latex3/latex3
On branch : master
Link : https://github.com/latex3/latex3/commit/33b0a51b9cef76430512e8746f7894737d46aeb7
>---------------------------------------------------------------
commit 33b0a51b9cef76430512e8746f7894737d46aeb7
Author: Bruno Le Floch <bruno at le-floch.fr>
Date: Sun May 6 00:23:16 2018 -0400
Simplify l3fparray storage of special values
>---------------------------------------------------------------
33b0a51b9cef76430512e8746f7894737d46aeb7
l3kernel/l3fparray.dtx | 49 +++++++++++++++----------------
l3kernel/testfiles/m3expl001.luatex.tlg | 5 ++--
l3kernel/testfiles/m3expl001.ptex.tlg | 5 ++--
l3kernel/testfiles/m3expl001.tlg | 5 ++--
l3kernel/testfiles/m3expl001.uptex.tlg | 5 ++--
l3kernel/testfiles/m3expl001.xetex.tlg | 5 ++--
l3kernel/testfiles/m3expl003.luatex.tlg | 5 ++--
l3kernel/testfiles/m3expl003.ptex.tlg | 5 ++--
l3kernel/testfiles/m3expl003.tlg | 5 ++--
l3kernel/testfiles/m3expl003.uptex.tlg | 5 ++--
l3kernel/testfiles/m3expl003.xetex.tlg | 5 ++--
11 files changed, 44 insertions(+), 55 deletions(-)
diff --git a/l3kernel/l3fparray.dtx b/l3kernel/l3fparray.dtx
index cfd0a96..94dbfb0 100644
--- a/l3kernel/l3fparray.dtx
+++ b/l3kernel/l3fparray.dtx
@@ -102,7 +102,9 @@
%
% \begin{macro}{\fparray_new:Nn, \@@_array_new:nNNN}
% Build a three token token list, then define all three tokens to be
-% integer arrays of the same size.
+% integer arrays of the same size. No need to initialize the data:
+% the integer arrays start with zeros, and three zeros denote
+% precisely \cs{c_zero_fp}, as we want.
% \begin{macrocode}
\cs_new_protected:Npn \fparray_new:Nn #1#2
{
@@ -128,14 +130,13 @@
\intarray_new:Nn #2 {#1}
\intarray_new:Nn #3 {#1}
\intarray_new:Nn #4 {#1}
- \fparray_gzero:N #5
}
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}[EXP]{\fparray_count:N}
-% Size of one of the intarrays. It's simplest to use the third.
+% Size of any of the intarrays, here we pick the third.
% \begin{macrocode}
\cs_new:Npn \fparray_count:N #1
{
@@ -175,7 +176,12 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\fparray_gset:Nnn, \@@_array_gset:Nww}
+% \begin{macro}
+% {
+% \fparray_gset:Nnn, \@@_array_gset:NNNNww, \@@_array_gset:w,
+% \@@_array_gset_recover:Nw, \@@_array_gset_special:nnNNN,
+% \@@_array_gset_normal:w
+% }
% Evaluate, then store exponent in one intarray, sign and $8$ digits
% of mantissa in the next, and $8$ trailing digits in the last.
% \begin{macrocode}
@@ -208,10 +214,10 @@
\cs_new_protected:Npn \@@_array_gset:w \s_@@ \@@_chk:w #1#2
{
\if_case:w #1 \exp_stop_f:
- \@@_case_return:nw { \@@_array_gset_zero:NnNNN #2 }
+ \@@_case_return:nw { \@@_array_gset_special:nnNNN {#2} }
\or: \exp_after:wN \@@_array_gset_normal:w
- \or: \@@_case_return:nw { \@@_array_gset_inf:NnNNN #2 }
- \or: \@@_case_return:nw { \@@_array_gset_nan:nNNN }
+ \or: \@@_case_return:nw { \@@_array_gset_special:nnNNN { #2 3 } }
+ \or: \@@_case_return:nw { \@@_array_gset_special:nnNNN { 1 } }
\fi:
\s_@@ \@@_chk:w #1 #2
}
@@ -223,23 +229,11 @@
{ \if_meaning:w 2 #1 3 \else: 1 \fi: #3#4 }
\__kernel_intarray_gset:Nnn #9 {#6} { 1 \use:nn #5 }
}
-\cs_new_protected:Npn \@@_array_gset_zero:NnNNN #1#2#3#4#5
+\cs_new_protected:Npn \@@_array_gset_special:nnNNN #1#2#3#4#5
{
\__kernel_intarray_gset:Nnn #3 {#2} {#1}
- \__kernel_intarray_gset:Nnn #4 {#2} {20000}
- \__kernel_intarray_gset:Nnn #5 {#2} {1}
- }
-\cs_new_protected:Npn \@@_array_gset_inf:NnNNN #1#2#3#4#5
- {
- \__kernel_intarray_gset:Nnn #3 {#2} { #1 3 }
- \__kernel_intarray_gset:Nnn #4 {#2} {20000}
- \__kernel_intarray_gset:Nnn #5 {#2} {1}
- }
-\cs_new_protected:Npn \@@_array_gset_nan:nNNN #1#2#3#4
- {
- \__kernel_intarray_gset:Nnn #2 {#1} {1}
- \__kernel_intarray_gset:Nnn #3 {#1} {20000}
- \__kernel_intarray_gset:Nnn #4 {#1} {1}
+ \__kernel_intarray_gset:Nnn #4 {#2} {0}
+ \__kernel_intarray_gset:Nnn #5 {#2} {0}
}
% \end{macrocode}
% \end{macro}
@@ -252,7 +246,7 @@
\prg_replicate:nn { \fparray_count:N #1 }
{
\int_incr:N \l_@@_array_loop_int
- \exp_after:wN \@@_array_gset_zero:NnNNN
+ \exp_after:wN \@@_array_gset_special:nnNNN
\exp_after:wN 0
\exp_after:wN \l_@@_array_loop_int
#1
@@ -267,6 +261,7 @@
% \fparray_item_to_tl:Nn,
% \@@_array_item:NwN,
% \@@_array_item:NNNnN,
+% \@@_array_item:N,
% \@@_array_item:w,
% \@@_array_item_special:w,
% \@@_array_item_normal:w
@@ -294,14 +289,18 @@
}
\cs_new:Npn \@@_array_item:NNNnN #1#2#3#4
{
- \exp_after:wN \@@_array_item:w
+ \exp_after:wN \@@_array_item:N
\int_value:w \__kernel_intarray_item:Nn #2 {#4} \exp_after:wN ;
\int_value:w \__kernel_intarray_item:Nn #3 {#4} \exp_after:wN ;
\int_value:w \__kernel_intarray_item:Nn #1 {#4} ;
}
+\cs_new:Npn \@@_array_item:N #1
+ {
+ \if_meaning:w 0 #1 \exp_after:wN \@@_array_item_special:w \fi:
+ \@@_array_item:w #1
+ }
\cs_new:Npn \@@_array_item:w #1 #2#3#4#5 #6 ; 1 #7 ;
{
- \if_meaning:w #1 2 \exp_after:wN \@@_array_item_special:w \fi:
\exp_after:wN \@@_array_item_normal:w
\int_value:w \if_meaning:w #1 1 0 \else: 2 \fi: \exp_stop_f:
#7 ; {#2#3#4#5} {#6} ;
diff --git a/l3kernel/testfiles/m3expl001.luatex.tlg b/l3kernel/testfiles/m3expl001.luatex.tlg
index 9366adb..73101cd 100644
--- a/l3kernel/testfiles/m3expl001.luatex.tlg
+++ b/l3kernel/testfiles/m3expl001.luatex.tlg
@@ -4275,14 +4275,13 @@ Defining \__fp_array_gset:NNNNww on line ...
Defining \__fp_array_gset_recover:Nw on line ...
Defining \__fp_array_gset:w on line ...
Defining \__fp_array_gset_normal:w on line ...
-Defining \__fp_array_gset_zero:NnNNN on line ...
-Defining \__fp_array_gset_inf:NnNNN on line ...
-Defining \__fp_array_gset_nan:nNNN on line ...
+Defining \__fp_array_gset_special:nnNNN on line ...
Defining \fparray_gzero:N on line ...
Defining \fparray_item:Nn on line ...
Defining \fparray_item_to_tl:Nn on line ...
Defining \__fp_array_item:NwN on line ...
Defining \__fp_array_item:NNNnN on line ...
+Defining \__fp_array_item:N on line ...
Defining \__fp_array_item:w on line ...
Defining \__fp_array_item_special:w on line ...
Defining \__fp_array_item_normal:w on line ...
diff --git a/l3kernel/testfiles/m3expl001.ptex.tlg b/l3kernel/testfiles/m3expl001.ptex.tlg
index b54ae48..8519f32 100644
--- a/l3kernel/testfiles/m3expl001.ptex.tlg
+++ b/l3kernel/testfiles/m3expl001.ptex.tlg
@@ -4530,14 +4530,13 @@ Defining \__fp_array_gset:NNNNww on line ...
Defining \__fp_array_gset_recover:Nw on line ...
Defining \__fp_array_gset:w on line ...
Defining \__fp_array_gset_normal:w on line ...
-Defining \__fp_array_gset_zero:NnNNN on line ...
-Defining \__fp_array_gset_inf:NnNNN on line ...
-Defining \__fp_array_gset_nan:nNNN on line ...
+Defining \__fp_array_gset_special:nnNNN on line ...
Defining \fparray_gzero:N on line ...
Defining \fparray_item:Nn on line ...
Defining \fparray_item_to_tl:Nn on line ...
Defining \__fp_array_item:NwN on line ...
Defining \__fp_array_item:NNNnN on line ...
+Defining \__fp_array_item:N on line ...
Defining \__fp_array_item:w on line ...
Defining \__fp_array_item_special:w on line ...
Defining \__fp_array_item_normal:w on line ...
diff --git a/l3kernel/testfiles/m3expl001.tlg b/l3kernel/testfiles/m3expl001.tlg
index 4b0b1cd..6a001b0 100644
--- a/l3kernel/testfiles/m3expl001.tlg
+++ b/l3kernel/testfiles/m3expl001.tlg
@@ -4530,14 +4530,13 @@ Defining \__fp_array_gset:NNNNww on line ...
Defining \__fp_array_gset_recover:Nw on line ...
Defining \__fp_array_gset:w on line ...
Defining \__fp_array_gset_normal:w on line ...
-Defining \__fp_array_gset_zero:NnNNN on line ...
-Defining \__fp_array_gset_inf:NnNNN on line ...
-Defining \__fp_array_gset_nan:nNNN on line ...
+Defining \__fp_array_gset_special:nnNNN on line ...
Defining \fparray_gzero:N on line ...
Defining \fparray_item:Nn on line ...
Defining \fparray_item_to_tl:Nn on line ...
Defining \__fp_array_item:NwN on line ...
Defining \__fp_array_item:NNNnN on line ...
+Defining \__fp_array_item:N on line ...
Defining \__fp_array_item:w on line ...
Defining \__fp_array_item_special:w on line ...
Defining \__fp_array_item_normal:w on line ...
diff --git a/l3kernel/testfiles/m3expl001.uptex.tlg b/l3kernel/testfiles/m3expl001.uptex.tlg
index c31e3b7..8a6f8a7 100644
--- a/l3kernel/testfiles/m3expl001.uptex.tlg
+++ b/l3kernel/testfiles/m3expl001.uptex.tlg
@@ -4529,14 +4529,13 @@ Defining \__fp_array_gset:NNNNww on line ...
Defining \__fp_array_gset_recover:Nw on line ...
Defining \__fp_array_gset:w on line ...
Defining \__fp_array_gset_normal:w on line ...
-Defining \__fp_array_gset_zero:NnNNN on line ...
-Defining \__fp_array_gset_inf:NnNNN on line ...
-Defining \__fp_array_gset_nan:nNNN on line ...
+Defining \__fp_array_gset_special:nnNNN on line ...
Defining \fparray_gzero:N on line ...
Defining \fparray_item:Nn on line ...
Defining \fparray_item_to_tl:Nn on line ...
Defining \__fp_array_item:NwN on line ...
Defining \__fp_array_item:NNNnN on line ...
+Defining \__fp_array_item:N on line ...
Defining \__fp_array_item:w on line ...
Defining \__fp_array_item_special:w on line ...
Defining \__fp_array_item_normal:w on line ...
diff --git a/l3kernel/testfiles/m3expl001.xetex.tlg b/l3kernel/testfiles/m3expl001.xetex.tlg
index 21685eb..ec48679 100644
--- a/l3kernel/testfiles/m3expl001.xetex.tlg
+++ b/l3kernel/testfiles/m3expl001.xetex.tlg
@@ -4247,14 +4247,13 @@ Defining \__fp_array_gset:NNNNww on line ...
Defining \__fp_array_gset_recover:Nw on line ...
Defining \__fp_array_gset:w on line ...
Defining \__fp_array_gset_normal:w on line ...
-Defining \__fp_array_gset_zero:NnNNN on line ...
-Defining \__fp_array_gset_inf:NnNNN on line ...
-Defining \__fp_array_gset_nan:nNNN on line ...
+Defining \__fp_array_gset_special:nnNNN on line ...
Defining \fparray_gzero:N on line ...
Defining \fparray_item:Nn on line ...
Defining \fparray_item_to_tl:Nn on line ...
Defining \__fp_array_item:NwN on line ...
Defining \__fp_array_item:NNNnN on line ...
+Defining \__fp_array_item:N on line ...
Defining \__fp_array_item:w on line ...
Defining \__fp_array_item_special:w on line ...
Defining \__fp_array_item_normal:w on line ...
diff --git a/l3kernel/testfiles/m3expl003.luatex.tlg b/l3kernel/testfiles/m3expl003.luatex.tlg
index 9366adb..73101cd 100644
--- a/l3kernel/testfiles/m3expl003.luatex.tlg
+++ b/l3kernel/testfiles/m3expl003.luatex.tlg
@@ -4275,14 +4275,13 @@ Defining \__fp_array_gset:NNNNww on line ...
Defining \__fp_array_gset_recover:Nw on line ...
Defining \__fp_array_gset:w on line ...
Defining \__fp_array_gset_normal:w on line ...
-Defining \__fp_array_gset_zero:NnNNN on line ...
-Defining \__fp_array_gset_inf:NnNNN on line ...
-Defining \__fp_array_gset_nan:nNNN on line ...
+Defining \__fp_array_gset_special:nnNNN on line ...
Defining \fparray_gzero:N on line ...
Defining \fparray_item:Nn on line ...
Defining \fparray_item_to_tl:Nn on line ...
Defining \__fp_array_item:NwN on line ...
Defining \__fp_array_item:NNNnN on line ...
+Defining \__fp_array_item:N on line ...
Defining \__fp_array_item:w on line ...
Defining \__fp_array_item_special:w on line ...
Defining \__fp_array_item_normal:w on line ...
diff --git a/l3kernel/testfiles/m3expl003.ptex.tlg b/l3kernel/testfiles/m3expl003.ptex.tlg
index b54ae48..8519f32 100644
--- a/l3kernel/testfiles/m3expl003.ptex.tlg
+++ b/l3kernel/testfiles/m3expl003.ptex.tlg
@@ -4530,14 +4530,13 @@ Defining \__fp_array_gset:NNNNww on line ...
Defining \__fp_array_gset_recover:Nw on line ...
Defining \__fp_array_gset:w on line ...
Defining \__fp_array_gset_normal:w on line ...
-Defining \__fp_array_gset_zero:NnNNN on line ...
-Defining \__fp_array_gset_inf:NnNNN on line ...
-Defining \__fp_array_gset_nan:nNNN on line ...
+Defining \__fp_array_gset_special:nnNNN on line ...
Defining \fparray_gzero:N on line ...
Defining \fparray_item:Nn on line ...
Defining \fparray_item_to_tl:Nn on line ...
Defining \__fp_array_item:NwN on line ...
Defining \__fp_array_item:NNNnN on line ...
+Defining \__fp_array_item:N on line ...
Defining \__fp_array_item:w on line ...
Defining \__fp_array_item_special:w on line ...
Defining \__fp_array_item_normal:w on line ...
diff --git a/l3kernel/testfiles/m3expl003.tlg b/l3kernel/testfiles/m3expl003.tlg
index 4b0b1cd..6a001b0 100644
--- a/l3kernel/testfiles/m3expl003.tlg
+++ b/l3kernel/testfiles/m3expl003.tlg
@@ -4530,14 +4530,13 @@ Defining \__fp_array_gset:NNNNww on line ...
Defining \__fp_array_gset_recover:Nw on line ...
Defining \__fp_array_gset:w on line ...
Defining \__fp_array_gset_normal:w on line ...
-Defining \__fp_array_gset_zero:NnNNN on line ...
-Defining \__fp_array_gset_inf:NnNNN on line ...
-Defining \__fp_array_gset_nan:nNNN on line ...
+Defining \__fp_array_gset_special:nnNNN on line ...
Defining \fparray_gzero:N on line ...
Defining \fparray_item:Nn on line ...
Defining \fparray_item_to_tl:Nn on line ...
Defining \__fp_array_item:NwN on line ...
Defining \__fp_array_item:NNNnN on line ...
+Defining \__fp_array_item:N on line ...
Defining \__fp_array_item:w on line ...
Defining \__fp_array_item_special:w on line ...
Defining \__fp_array_item_normal:w on line ...
diff --git a/l3kernel/testfiles/m3expl003.uptex.tlg b/l3kernel/testfiles/m3expl003.uptex.tlg
index c31e3b7..8a6f8a7 100644
--- a/l3kernel/testfiles/m3expl003.uptex.tlg
+++ b/l3kernel/testfiles/m3expl003.uptex.tlg
@@ -4529,14 +4529,13 @@ Defining \__fp_array_gset:NNNNww on line ...
Defining \__fp_array_gset_recover:Nw on line ...
Defining \__fp_array_gset:w on line ...
Defining \__fp_array_gset_normal:w on line ...
-Defining \__fp_array_gset_zero:NnNNN on line ...
-Defining \__fp_array_gset_inf:NnNNN on line ...
-Defining \__fp_array_gset_nan:nNNN on line ...
+Defining \__fp_array_gset_special:nnNNN on line ...
Defining \fparray_gzero:N on line ...
Defining \fparray_item:Nn on line ...
Defining \fparray_item_to_tl:Nn on line ...
Defining \__fp_array_item:NwN on line ...
Defining \__fp_array_item:NNNnN on line ...
+Defining \__fp_array_item:N on line ...
Defining \__fp_array_item:w on line ...
Defining \__fp_array_item_special:w on line ...
Defining \__fp_array_item_normal:w on line ...
diff --git a/l3kernel/testfiles/m3expl003.xetex.tlg b/l3kernel/testfiles/m3expl003.xetex.tlg
index 21685eb..ec48679 100644
--- a/l3kernel/testfiles/m3expl003.xetex.tlg
+++ b/l3kernel/testfiles/m3expl003.xetex.tlg
@@ -4247,14 +4247,13 @@ Defining \__fp_array_gset:NNNNww on line ...
Defining \__fp_array_gset_recover:Nw on line ...
Defining \__fp_array_gset:w on line ...
Defining \__fp_array_gset_normal:w on line ...
-Defining \__fp_array_gset_zero:NnNNN on line ...
-Defining \__fp_array_gset_inf:NnNNN on line ...
-Defining \__fp_array_gset_nan:nNNN on line ...
+Defining \__fp_array_gset_special:nnNNN on line ...
Defining \fparray_gzero:N on line ...
Defining \fparray_item:Nn on line ...
Defining \fparray_item_to_tl:Nn on line ...
Defining \__fp_array_item:NwN on line ...
Defining \__fp_array_item:NNNnN on line ...
+Defining \__fp_array_item:N on line ...
Defining \__fp_array_item:w on line ...
Defining \__fp_array_item_special:w on line ...
Defining \__fp_array_item_normal:w on line ...
More information about the latex3-commits
mailing list