more casts to make old GCC happy
... plus, a bot that uses said old GCC!
Change-Id: Idd242ece4a1a2e02af53faf5637bdaf696957349
Reviewed-on: https://skia-review.googlesource.com/99863
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>
diff --git a/build.ninja b/build.ninja
index ceb84b8..e1b3b1a 100644
--- a/build.ninja
+++ b/build.ninja
@@ -29,6 +29,8 @@
subninja build/android-arm.tiny
subninja build/android-arm.vfpv2
+subninja build/android-arm-gcc
+
subninja build/ios
subninja build/ios.portable
subninja build/ios.tiny
diff --git a/build/android-arm-gcc b/build/android-arm-gcc
new file mode 100644
index 0000000..0cd530b
--- /dev/null
+++ b/build/android-arm-gcc
@@ -0,0 +1,27 @@
+ndk = ../ndk
+target = arm-linux-androideabi
+arch = arch-arm
+ndk_api = 24
+
+cc = $ndk/toolchains/${target}-4.9/prebuilt/*/bin/${target}-gcc
+cflags = -fdiagnostics-color -Wall -Wextra -Wno-abi -Wno-type-limits $
+ -std=c11 -flax-vector-conversions $
+ -march=armv7-a -mfpu=neon -mthumb -mfloat-abi=softfp $
+ --sysroot $ndk/sysroot $
+ -I $ndk/sysroot/usr/include/$target
+ldflags = -pie -fuse-ld=gold $
+ --sysroot $ndk/platforms/android-$ndk_api/$arch $
+ -B $ndk/toolchains/${target}-4.9/prebuilt/*/$target/bin $
+ -L $ndk/toolchains/${target}-4.9/prebuilt/*/lib/gcc/$target/4.9.x
+out = out/android-arm-gcc$mode
+
+rule run
+ command = if which adb >/dev/null && adb get-state >/dev/null 2>/dev/null; $
+ then $
+ adb push $in /data/local/tmp/$in >/dev/null; $
+ adb shell "cd /data/local/tmp; ./$in" > $out; $
+ else touch $out; fi
+ description = run $in
+include build/common
+
+
diff --git a/src/Transform.c b/src/Transform.c
index 3a34ce8..3f4ec75 100644
--- a/src/Transform.c
+++ b/src/Transform.c
@@ -429,9 +429,9 @@
uint16_t* rgb = (uint16_t*)ptr; // for this cast to uint16_t* to be safe.
#if defined(USING_NEON)
uint16x4x3_t v = {{
- swap_endian_16(CAST(U16, to_fixed(r * 65535))),
- swap_endian_16(CAST(U16, to_fixed(g * 65535))),
- swap_endian_16(CAST(U16, to_fixed(b * 65535))),
+ (uint16x4_t)swap_endian_16(CAST(U16, to_fixed(r * 65535))),
+ (uint16x4_t)swap_endian_16(CAST(U16, to_fixed(g * 65535))),
+ (uint16x4_t)swap_endian_16(CAST(U16, to_fixed(b * 65535))),
}};
vst3_u16(rgb, v);
#else
@@ -453,10 +453,10 @@
uint16_t* rgba = (uint16_t*)ptr; // for this cast to uint16_t* to be safe.
#if defined(USING_NEON)
uint16x4x4_t v = {{
- swap_endian_16(CAST(U16, to_fixed(r * 65535))),
- swap_endian_16(CAST(U16, to_fixed(g * 65535))),
- swap_endian_16(CAST(U16, to_fixed(b * 65535))),
- swap_endian_16(CAST(U16, to_fixed(a * 65535))),
+ (uint16x4_t)swap_endian_16(CAST(U16, to_fixed(r * 65535))),
+ (uint16x4_t)swap_endian_16(CAST(U16, to_fixed(g * 65535))),
+ (uint16x4_t)swap_endian_16(CAST(U16, to_fixed(b * 65535))),
+ (uint16x4_t)swap_endian_16(CAST(U16, to_fixed(a * 65535))),
}};
vst4_u16(rgba, v);
#else
@@ -480,7 +480,11 @@
G = Half_from_F(g),
B = Half_from_F(b);
#if defined(USING_NEON)
- uint16x4x3_t v = {{ R,G,B }};
+ uint16x4x3_t v = {{
+ (uint16x4_t)R,
+ (uint16x4_t)G,
+ (uint16x4_t)B,
+ }};
vst3_u16(rgb, v);
#else
STORE_3(rgb+0, R);
@@ -502,7 +506,12 @@
B = Half_from_F(b),
A = Half_from_F(a);
#if defined(USING_NEON)
- uint16x4x4_t v = {{ R,G,B,A }};
+ uint16x4x4_t v = {{
+ (uint16x4_t)R,
+ (uint16x4_t)G,
+ (uint16x4_t)B,
+ (uint16x4_t)A,
+ }};
vst4_u16(rgba, v);
#else
U64 px = CAST(U64, R) << 0
@@ -520,7 +529,11 @@
assert( (ptr & 3) == 0 ); // The dst pointer must be 4-byte aligned
float* rgb = (float*)ptr; // for this cast to float* to be safe.
#if defined(USING_NEON)
- float32x4x3_t v = {{r,g,b}};
+ float32x4x3_t v = {{
+ (float32x4_t)r,
+ (float32x4_t)g,
+ (float32x4_t)b,
+ }};
vst3q_f32(rgb, v);
#else
STORE_3(rgb+0, r);
@@ -537,7 +550,12 @@
assert( (ptr & 3) == 0 ); // The dst pointer must be 4-byte aligned
float* rgba = (float*)ptr; // for this cast to float* to be safe.
#if defined(USING_NEON)
- float32x4x4_t v = {{r,g,b,a}};
+ float32x4x4_t v = {{
+ (float32x4_t)r,
+ (float32x4_t)g,
+ (float32x4_t)b,
+ (float32x4_t)a,
+ }};
vst4q_f32(rgba, v);
#else
STORE_4(rgba+0, r);