am bcae1fe6: Switch to FieldPacker for signed sub-integer types.
* commit 'bcae1fe692a8c5d9225a9699a932380b5659a735':
Switch to FieldPacker for signed sub-integer types.
diff --git a/slang_rs_reflection.cpp b/slang_rs_reflection.cpp
index cd088a4..05ec938 100644
--- a/slang_rs_reflection.cpp
+++ b/slang_rs_reflection.cpp
@@ -852,10 +852,12 @@
"set_" + VarName,
1,
TypeName.c_str(), "v");
- if (EV->isUnsigned()) {
+ if ((EPT->getSize() < 4) || EV->isUnsigned()) {
// We create/cache a per-type FieldPacker. This allows us to reuse the
// validation logic (for catching negative inputs from Dalvik, as well
// as inputs that are too large to be represented in the unsigned type).
+ // Sub-integer types are also handled specially here, so that we don't
+ // overwrite bytes accidentally.
std::string ElemName = EPT->getElementName();
std::string FPName;
FPName = RS_FP_PREFIX + ElemName;