Skip to content

Commit 25a2e19

Browse files
committed
Fixes for correct build with C++
1 parent 36898a7 commit 25a2e19

File tree

4 files changed

+22
-5
lines changed

4 files changed

+22
-5
lines changed

arm-neon.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626

2727
#include <stdint.h>
2828

29+
#ifdef __cplusplus
30+
extern "C" {
31+
#endif
32+
2933
void aligned_block_copy_neon(int64_t * __restrict dst,
3034
int64_t * __restrict src,
3135
int size);
@@ -52,5 +56,8 @@ void aligned_block_fill_neon(int64_t * __restrict dst,
5256
int64_t * __restrict src,
5357
int size);
5458

59+
#ifdef __cplusplus
60+
}
61+
#endif
5562

5663
#endif

asm-opt.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <string.h>
2525
#include <stdio.h>
2626
#include <stdlib.h>
27+
#include <ctype.h>
2728
#include "asm-opt.h"
2829

2930
#if defined(__linux__) || defined(ANDROID) || defined(__ANDROID__)
@@ -40,7 +41,7 @@
4041
#define FEATURES_ID "?"
4142
#endif
4243

43-
static int check_feature (const char *buffer, const char *feature)
44+
static int check_feature (char *buffer, const char *feature)
4445
{
4546
char *p;
4647
if (*feature == 0)

main.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ void latency_bench(int size, int count)
220220

221221
int main(void)
222222
{
223-
int dummy;
224223
int64_t *srcbuf, *dstbuf, *tmpbuf;
225224
void *poolbuf = alloc_four_nonaliased_buffers((void **)&srcbuf, SIZE,
226225
(void **)&dstbuf, SIZE,
@@ -238,9 +237,12 @@ int main(void)
238237
bandwidth_bench(dstbuf, srcbuf, tmpbuf, SIZE, BLOCKSIZE, " ");
239238
free(poolbuf);
240239

241-
dummy = posix_memalign((void **)&srcbuf, 128, SIZE);
242-
dummy = posix_memalign((void **)&dstbuf, 128, SIZE);
243-
dummy = posix_memalign((void **)&tmpbuf, 128, BLOCKSIZE);
240+
if (posix_memalign((void **)&srcbuf, 128, SIZE) != 0)
241+
return 1;
242+
if (posix_memalign((void **)&dstbuf, 128, SIZE) != 0)
243+
return 1;
244+
if (posix_memalign((void **)&tmpbuf, 128, BLOCKSIZE) != 0)
245+
return 1;
244246
memset(srcbuf, 0xCC, SIZE);
245247
memset(dstbuf, 0xCC, SIZE);
246248
memset(tmpbuf, 0xCC, BLOCKSIZE);

x86-sse2.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626

2727
#include <stdint.h>
2828

29+
#ifdef __cplusplus
30+
extern "C" {
31+
#endif
32+
2933
void aligned_block_copy_sse2(int64_t * __restrict dst,
3034
int64_t * __restrict src,
3135
int size);
@@ -55,5 +59,8 @@ void aligned_block_fill_nt_sse2(int64_t * __restrict dst,
5559
int64_t * __restrict src,
5660
int size);
5761

62+
#ifdef __cplusplus
63+
}
64+
#endif
5865

5966
#endif

0 commit comments

Comments
 (0)