diff options
author | hovertank3d <[email protected]> | 2025-01-17 17:31:09 +0100 |
---|---|---|
committer | hovertank3d <[email protected]> | 2025-01-17 17:31:09 +0100 |
commit | f60aec7f3669d9cd2e099d75b9d4ccd37035da57 (patch) | |
tree | 8d54fb17bb98eb0f19f9508df93e5592d57238ef | |
parent | 234a2ba96aeb91fb30603a90de22d71fc29632dd (diff) | |
download | lzcnt.space-f60aec7f3669d9cd2e099d75b9d4ccd37035da57.tar.xz lzcnt.space-f60aec7f3669d9cd2e099d75b9d4ccd37035da57.zip |
implement reset button
-rw-r--r-- | main.go | 5 | ||||
-rw-r--r-- | templates/index.html | 4 |
2 files changed, 8 insertions, 1 deletions
@@ -31,6 +31,11 @@ func main() { log.Fatal(err) } + http.HandleFunc("/reset", func(w http.ResponseWriter, r *http.Request) { + counter.Store(0) + http.Redirect(w, r, "/", http.StatusSeeOther) + }) + http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { n := counter.Add(1) payload := struct { diff --git a/templates/index.html b/templates/index.html index 1d75a2c..dd4cb2a 100644 --- a/templates/index.html +++ b/templates/index.html @@ -54,13 +54,15 @@ background-color: rgb(31, 31, 31); } </style> + <form id="reset" action="/reset" method="get"></form> </head> <body> <div style="display: flex; justify-content: center;"></div> <h2 style="text-align: center;"><code>LZCNT - Count the Number of Leading Zero Bits</code></h2> <pre class="listing"><code> - <code class="comment"># <a href="https://github.com/hovertank3d/lzcnt.space"><code>[source code]</code></a></code> + <code class="comment"># <a href="https://github.com/hovertank3d/lzcnt.space">[source code]</a></code> + <code class="comment"># <a href="javascript:{}" onclick="document.getElementById('reset').submit(); return false;">[reset counter]</a></code> <code class="label">log2lzcnt:</code> <code class="comment"># log2lzcnt({{.Requests}});</code> <b><code class="ins"> lzcnt </code></b><code class="reg">%rdi</code>, <code class="reg">%rdi</code> <code class="ins"> movq </code><code class="imm">$63</code>, <code class="reg">%rax</code> |