Skip to content

Commit

Permalink
[common] fix compilation on clang
Browse files Browse the repository at this point in the history
  • Loading branch information
gnif committed Nov 18, 2023
1 parent 3330f83 commit 584de41
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
14 changes: 11 additions & 3 deletions common/src/framebuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,12 @@ static bool framebuffer_write_sse4_1(FrameBuffer * frame,
return true;
}

#pragma GCC push_options
#pragma GCC target ("avx2")
#ifdef __clang__
#pragma clang attribute push (__attribute__((target("avx2"))), apply_to=function)
#else
#pragma GCC push_options
#pragma GCC target ("avx2")
#endif
bool framebuffer_write_avx2(FrameBuffer * frame,
const void * restrict src, size_t size)
{
Expand Down Expand Up @@ -303,7 +307,11 @@ bool framebuffer_write_avx2(FrameBuffer * frame,

return true;
}
#pragma GCC pop_options
#ifdef __clang__
#pragma clang attribute pop
#else
#pragma GCC pop_options
#endif

static bool _framebuffer_write(FrameBuffer * frame,
const void * restrict src, size_t size)
Expand Down
14 changes: 11 additions & 3 deletions common/src/rects.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,12 @@ static void rectCopyUnaligned_memcpy(uint8_t * dst, const uint8_t * src,
}
}

#pragma GCC push_options
#pragma GCC target ("avx2")
#ifdef __clang__
#pragma clang attribute push (__attribute__((target("avx"))), apply_to=function)
#else
#pragma GCC push_options
#pragma GCC target ("avx")
#endif
static void rectCopyUnaligned_avx(uint8_t * dst, const uint8_t * src,
int ystart, int yend, int dx, int dstPitch, int srcPitch, int width)
{
Expand All @@ -338,7 +342,11 @@ static void rectCopyUnaligned_avx(uint8_t * dst, const uint8_t * src,
dst += dstPitch;
}
}
#pragma GCC pop_options
#ifdef __clang__
#pragma clang attribute pop
#else
#pragma GCC pop_options
#endif

static void _rectCopyUnaligned(uint8_t * dst, const uint8_t * src,
int ystart, int yend, int dx, int dstPitch, int srcPitch, int width)
Expand Down

0 comments on commit 584de41

Please sign in to comment.