aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShow Liu <show.liu@linaro.org>2015-06-16 11:56:50 +0800
committerGil Pitney <gil.pitney@linaro.org>2015-06-16 17:24:03 +0000
commite7161be3b642ca019ddb2c7d3ffbcb5693c5d1d7 (patch)
treea09a0c3eb3425db19d3a99e75dd5a28096265047
parentbf50e9af8c89111f9c3ea28a717c0d8cda849c4f (diff)
downloadshamrock-e7161be3b642ca019ddb2c7d3ffbcb5693c5d1d7.tar.gz
fixed the upsample() builtin function crash issue
-rw-r--r--include/cpu.h23
1 files changed, 17 insertions, 6 deletions
diff --git a/include/cpu.h b/include/cpu.h
index 82b5dfa..5775989 100644
--- a/include/cpu.h
+++ b/include/cpu.h
@@ -218,12 +218,23 @@ BINARY_VEC_DECL(uint, uint, sub_sat)
BINARY_VEC_DECL(long, long, sub_sat)
BINARY_VEC_DECL(ulong, ulong, sub_sat)
-_CLC_OVERLOAD _CLC_DECL short upsample(char x, uchar y) ;
-_CLC_OVERLOAD _CLC_DECL ushort upsample(uchar x, uchar y) ;
-_CLC_OVERLOAD _CLC_DECL int upsample(short x, ushort y) ;
-_CLC_OVERLOAD _CLC_DECL uint upsample(ushort x, ushort y) ;
-_CLC_OVERLOAD _CLC_DECL long upsample(int x, uint y) ;
-_CLC_OVERLOAD _CLC_DECL ulong upsample(uint x, uint y) ;
+_CLC_OVERLOAD _CLC_INLINE short upsample(char x, uchar y)
+{ return (short)x << 8 | y; }
+
+_CLC_OVERLOAD _CLC_INLINE ushort upsample(uchar x, uchar y)
+{ return (ushort)x << 8 | y; }
+
+_CLC_OVERLOAD _CLC_INLINE int upsample(short x, ushort y)
+{ return (int) x << 16 | y; }
+
+_CLC_OVERLOAD _CLC_INLINE uint upsample(ushort x, ushort y)
+{ return (uint) x << 16 | y; }
+
+_CLC_OVERLOAD _CLC_INLINE long upsample(int x, uint y)
+{ return (long) x << 32 | y; }
+
+_CLC_OVERLOAD _CLC_INLINE ulong upsample(uint x, uint y)
+{ return (ulong) x << 32 | y; }
BINARY_VEC_DECL_ALT(char, short, uchar, upsample)
BINARY_VEC_DECL_ALT(uchar, ushort, uchar, upsample)