1 #pragma version(1) 2 #pragma rs java_package_name(foo) 3 4 rs_allocation A; 5 static void foo() { 6 // Basic scalar and floating point types. 7 float a = 4.0f; 8 double d = 4.0f; 9 float2 a2 = {4.0f, 4.0f}; 10 float3 a3 = {4.0f, 4.0f, 4.0f}; 11 float4 a4 = {4.0f, 4.0f, 4.0f, 4.0f}; 12 char c = 4; 13 uchar uc = 4; 14 short s = 4; 15 ushort us = 4; 16 int i = 4; 17 uint ui = 4; 18 long l = 4; 19 ulong ul = 4; 20 21 rsSetElementAt(A, &a, 0, 0); 22 rsSetElementAt(A, &d, 0, 0); 23 rsSetElementAt(A, &a2, 0, 0); 24 rsSetElementAt(A, &a3, 0, 0); 25 rsSetElementAt(A, &a4, 0, 0); 26 rsSetElementAt(A, &c, 0, 0); 27 rsSetElementAt(A, &uc, 0, 0); 28 rsSetElementAt(A, &s, 0, 0); 29 rsSetElementAt(A, &us, 0, 0); 30 rsSetElementAt(A, &i, 0, 0); 31 rsSetElementAt(A, &ui, 0, 0); 32 rsSetElementAt(A, &l, 0, 0); 33 rsSetElementAt(A, &ul, 0, 0); 34 35 // No warnings for complex data types 36 struct { 37 int A; 38 int B; 39 } P; 40 rsSetElementAt(A, &P, 0, 0); 41 42 // No warning for 'long long' 43 long long LL = 4.0f; 44 rsSetElementAt(A, &LL, 0, 0); 45 46 // Unsupported vector width 47 typedef int int5 __attribute__((ext_vector_type(5))); 48 int5 i5 = {5, 5, 5, 5, 5}; 49 50 rsSetElementAt(A, &i5, 0, 0); 51 } 52 53