From 342b251a2f24263651a4a4104ab8129560d7dd53 Mon Sep 17 00:00:00 2001 From: hovertank3d Date: Sat, 18 Jan 2025 13:57:23 +0100 Subject: use genhl instead of hardcoding syntax --- templates/gen.go | 3 +++ templates/index.html | 53 ++++++---------------------------------------- templates/log2.s.html | 11 ++++++++++ templates/reset.html | 1 + templates/source_code.html | 1 + 5 files changed, 22 insertions(+), 47 deletions(-) create mode 100644 templates/gen.go create mode 100644 templates/log2.s.html create mode 100644 templates/reset.html create mode 100644 templates/source_code.html (limited to 'templates') diff --git a/templates/gen.go b/templates/gen.go new file mode 100644 index 0000000..852291d --- /dev/null +++ b/templates/gen.go @@ -0,0 +1,3 @@ +package templates + +//go:generate bash -c "cat ../log2.s | genhl > log2.s.html" diff --git a/templates/index.html b/templates/index.html index dd4cb2a..85eccab 100644 --- a/templates/index.html +++ b/templates/index.html @@ -20,56 +20,15 @@ LZCNT - - -
+
-
-

LZCNT - Count the Number of Leading Zero Bits

-

-  # [source code]
-  # [reset counter]
-  log2lzcnt:                # log2lzcnt({{.Requests}});  
-      lzcnt   %rdi, %rdi  
-      movq    $63,  %rax  
-      sub     %rdi, %rax  
-      ret                   # 2^{{.Log2lzcnt}} requests handled  
-
-
+
+

LZCNT - Count the Number of Leading Zero Bits

+
+
+ {{template "log2.s.html" .}}
diff --git a/templates/log2.s.html b/templates/log2.s.html new file mode 100644 index 0000000..a16ccca --- /dev/null +++ b/templates/log2.s.html @@ -0,0 +1,11 @@ +
    .section    .text
+    .global     log2lzcnt
+    .type       log2lzcnt, @function
+# {{template "source_code.html" .}}
+# {{template "reset.html" .}}
+log2lzcnt:              # log2lzcnt({{.Requests}});
+    lzcnt   %rdi, %rdi 
+    movq    $63,  %rax
+    sub     %rdi, %rax
+    ret                 # 2^{{.Log2lzcnt}} requests handled
+
\ No newline at end of file diff --git a/templates/reset.html b/templates/reset.html new file mode 100644 index 0000000..090b273 --- /dev/null +++ b/templates/reset.html @@ -0,0 +1 @@ +[reset counter] \ No newline at end of file diff --git a/templates/source_code.html b/templates/source_code.html new file mode 100644 index 0000000..631c649 --- /dev/null +++ b/templates/source_code.html @@ -0,0 +1 @@ +[source code] \ No newline at end of file -- cgit v1.2.3