Skip to content

Commit

Permalink
Update hist.c
Browse files Browse the repository at this point in the history
  • Loading branch information
camel-cdr authored Nov 15, 2024
1 parent 9546409 commit dba9649
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions bench/hist.c
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
#include "bench.h"

#if __STDC_HOSTED__
#include <math.h>
#endif

void
hist_scalar(uint32_t *hist, float *x, float *y, size_t n)
{
for (size_t i = 0; i < n; ++i) {
float dist = x[i]*x[i] + y[i]*y[i];
#if __STDC_HOSTED__
dist = sqrtf(dist);
#else
__asm volatile("fsqrt.s %0, %0\n" : "+f"(dist));
#endif
size_t idx = dist;
idx = idx > 100 ? 100 : dist;
++hist[idx];
Expand Down

0 comments on commit dba9649

Please sign in to comment.