You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 1, 2021. It is now read-only.
I am trying to build a C function for variance of a population. I am building it with only c99, c2goasm and clang for mac.
clang works as expected. c2goasm works as expected. however the assembly produced by c2goasm does not work in the build process for go.
go compiler outputs
./stats_nocgo.s:431: expected identifier, found "."
asm: assembly of ./stats_nocgo.s failed
I have posted a working example of this issue as a small github project on my profile.
do make test to see the message above.
Gist of the Code
My c-code looks like
#include <stdint.h>
#define SIZE 16
void variance_uint32_nocgo_darwin(uint32_t buf[], int len, double *result) {
double intermediate[SIZE];
uint32_t sum = 0;
for (int i = 0; i < len; i++) {
uint32_t value = buf[i];
sum += value;
}
double mean = sum / ((double)len);
double accumulator = 0.0;
for (int j = 0; j < len / SIZE; j++) {
for (int i = 0; i < SIZE; i++) {
intermediate[i] = (double)buf[(j * SIZE) + i];
}
for (int i = 0; i < SIZE; i++) {
double value = intermediate[i];
double diff = value - mean;
intermediate[i] = diff;
}
for (int i = 0; i < SIZE; i++) {
double diff = intermediate[i];
accumulator += diff * diff;
}
}
int start = (len - (len % SIZE));
for (int i = start; i < len; i++) {
intermediate[i - start] = (double)buf[i];
}
int end = (len % SIZE);
for (int i = 0; i < end; i++) {
double value = intermediate[i];
double diff = value - mean;
intermediate[i] = diff;
}
for (int i = 0; i < end; i++) {
double diff = intermediate[i];
accumulator += diff * diff;
}
double variance = accumulator / (double)(len - 1);
*result = variance;
}
I have also uploaded the output assembly from clang and and c2goasm into as separte folders called examples
I am trying to build a C function for variance of a population. I am building it with only c99, c2goasm and clang for mac.
clang works as expected. c2goasm works as expected. however the assembly produced by c2goasm does not work in the build process for go.
go compiler outputs
I have posted a working example of this issue as a small github project on my profile.
do make test to see the message above.
Gist of the Code
My c-code looks like
I have also uploaded the output assembly from clang and and c2goasm into as separte folders called examples
Build and run
I am bulding with
The
System Information
go version 13.
Running on macOS 10.14.6
The text was updated successfully, but these errors were encountered: