Short4 warnings fixed

Switched the Short4 constructor from 'short' to 'unsigned short'
in order to accept hexadecimal values, which is generally how
Short4 values are initialized.

Change-Id: I89eb41bfd65f9071ba42dbb6a06d4349cbb89d67
Reviewed-on: https://swiftshader-review.googlesource.com/5701
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
diff --git a/src/Reactor/Nucleus.cpp b/src/Reactor/Nucleus.cpp
index 09c547e..820bdd5 100644
--- a/src/Reactor/Nucleus.cpp
+++ b/src/Reactor/Nucleus.cpp
@@ -3270,6 +3270,20 @@
 	//	xyzw.parent = this;
 	}
 
+	UShort4::UShort4(unsigned short xyzw)
+	{
+		//	xyzw.parent = this;
+
+		Constant *constantVector[4];
+		constantVector[0] = Nucleus::createConstantShort(xyzw);
+		constantVector[1] = Nucleus::createConstantShort(xyzw);
+		constantVector[2] = Nucleus::createConstantShort(xyzw);
+		constantVector[3] = Nucleus::createConstantShort(xyzw);
+		Value *vector = Nucleus::createConstantVector(constantVector, 4);
+
+		storeValue(Nucleus::createBitCast(vector, getType()));
+	}
+
 	UShort4::UShort4(unsigned short x, unsigned short y, unsigned short z, unsigned short w)
 	{
 	//	xyzw.parent = this;
diff --git a/src/Reactor/Nucleus.hpp b/src/Reactor/Nucleus.hpp
index 3aab2d2..90e67c9 100644
--- a/src/Reactor/Nucleus.hpp
+++ b/src/Reactor/Nucleus.hpp
@@ -1005,6 +1005,7 @@
 		explicit UShort4(RValue<Float4> cast, bool saturate = false);
 
 		UShort4();
+		UShort4(unsigned short xyzw);
 		UShort4(unsigned short x, unsigned short y, unsigned short z, unsigned short w);
 		UShort4(RValue<UShort4> rhs);
 		UShort4(const UShort4 &rhs);
diff --git a/src/Shader/PixelPipeline.cpp b/src/Shader/PixelPipeline.cpp
index 5987768..66d6a09 100644
--- a/src/Shader/PixelPipeline.cpp
+++ b/src/Shader/PixelPipeline.cpp
@@ -27,10 +27,10 @@
 		if(state.color[0].component & 0x4) diffuse.z = convertFixed12(v[0].z); else diffuse.z = Short4(0x1000);
 		if(state.color[0].component & 0x8) diffuse.w = convertFixed12(v[0].w); else diffuse.w = Short4(0x1000);
 
-		if(state.color[1].component & 0x1) specular.x = convertFixed12(v[1].x); else specular.x = Short4(0x0000, 0x0000, 0x0000, 0x0000);
-		if(state.color[1].component & 0x2) specular.y = convertFixed12(v[1].y); else specular.y = Short4(0x0000, 0x0000, 0x0000, 0x0000);
-		if(state.color[1].component & 0x4) specular.z = convertFixed12(v[1].z); else specular.z = Short4(0x0000, 0x0000, 0x0000, 0x0000);
-		if(state.color[1].component & 0x8) specular.w = convertFixed12(v[1].w); else specular.w = Short4(0x0000, 0x0000, 0x0000, 0x0000);
+		if(state.color[1].component & 0x1) specular.x = convertFixed12(v[1].x); else specular.x = Short4(0x0000);
+		if(state.color[1].component & 0x2) specular.y = convertFixed12(v[1].y); else specular.y = Short4(0x0000);
+		if(state.color[1].component & 0x4) specular.z = convertFixed12(v[1].z); else specular.z = Short4(0x0000);
+		if(state.color[1].component & 0x8) specular.w = convertFixed12(v[1].w); else specular.w = Short4(0x0000);
 	}
 
 	void PixelPipeline::fixedFunction()
@@ -229,10 +229,10 @@
 
 				if(dst.saturate)
 				{
-					if(dst.mask & 0x1) { d.x = Min(d.x, Short4(0x1000)); d.x = Max(d.x, Short4(0x0000, 0x0000, 0x0000, 0x0000)); }
-					if(dst.mask & 0x2) { d.y = Min(d.y, Short4(0x1000)); d.y = Max(d.y, Short4(0x0000, 0x0000, 0x0000, 0x0000)); }
-					if(dst.mask & 0x4) { d.z = Min(d.z, Short4(0x1000)); d.z = Max(d.z, Short4(0x0000, 0x0000, 0x0000, 0x0000)); }
-					if(dst.mask & 0x8) { d.w = Min(d.w, Short4(0x1000)); d.w = Max(d.w, Short4(0x0000, 0x0000, 0x0000, 0x0000)); }
+					if(dst.mask & 0x1) { d.x = Min(d.x, Short4(0x1000)); d.x = Max(d.x, Short4(0x0000)); }
+					if(dst.mask & 0x2) { d.y = Min(d.y, Short4(0x1000)); d.y = Max(d.y, Short4(0x0000)); }
+					if(dst.mask & 0x4) { d.z = Min(d.z, Short4(0x1000)); d.z = Max(d.z, Short4(0x0000)); }
+					if(dst.mask & 0x8) { d.w = Min(d.w, Short4(0x1000)); d.w = Max(d.w, Short4(0x0000)); }
 				}
 
 				if(pairing)
@@ -260,10 +260,10 @@
 
 	Bool PixelPipeline::alphaTest(Int cMask[4])
 	{
-		current.x = Min(current.x, Short4(0x0FFF, 0x0FFF, 0x0FFF, 0x0FFF)); current.x = Max(current.x, Short4(0x0000, 0x0000, 0x0000, 0x0000));
-		current.y = Min(current.y, Short4(0x0FFF, 0x0FFF, 0x0FFF, 0x0FFF)); current.y = Max(current.y, Short4(0x0000, 0x0000, 0x0000, 0x0000));
-		current.z = Min(current.z, Short4(0x0FFF, 0x0FFF, 0x0FFF, 0x0FFF)); current.z = Max(current.z, Short4(0x0000, 0x0000, 0x0000, 0x0000));
-		current.w = Min(current.w, Short4(0x0FFF, 0x0FFF, 0x0FFF, 0x0FFF)); current.w = Max(current.w, Short4(0x0000, 0x0000, 0x0000, 0x0000));
+		current.x = Min(current.x, Short4(0x0FFF)); current.x = Max(current.x, Short4(0x0000));
+		current.y = Min(current.y, Short4(0x0FFF)); current.y = Max(current.y, Short4(0x0000));
+		current.z = Min(current.z, Short4(0x0FFF)); current.z = Max(current.z, Short4(0x0000));
+		current.w = Min(current.w, Short4(0x0FFF)); current.w = Max(current.w, Short4(0x0000));
 
 		if(!state.alphaTestActive())
 		{
@@ -622,18 +622,18 @@
 			res.y = AddSat(arg1->y, arg2->y);
 			res.z = AddSat(arg1->z, arg2->z);
 
-			res.x = SubSat(res.x, Short4(0x0800, 0x0800, 0x0800, 0x0800));
-			res.y = SubSat(res.y, Short4(0x0800, 0x0800, 0x0800, 0x0800));
-			res.z = SubSat(res.z, Short4(0x0800, 0x0800, 0x0800, 0x0800));
+			res.x = SubSat(res.x, Short4(0x0800));
+			res.y = SubSat(res.y, Short4(0x0800));
+			res.z = SubSat(res.z, Short4(0x0800));
 			break;
 		case TextureStage::STAGE_ADDSIGNED2X: // (Arg1 + Arg2 - 0.5) << 1
 			res.x = AddSat(arg1->x, arg2->x);
 			res.y = AddSat(arg1->y, arg2->y);
 			res.z = AddSat(arg1->z, arg2->z);
 
-			res.x = SubSat(res.x, Short4(0x0800, 0x0800, 0x0800, 0x0800));
-			res.y = SubSat(res.y, Short4(0x0800, 0x0800, 0x0800, 0x0800));
-			res.z = SubSat(res.z, Short4(0x0800, 0x0800, 0x0800, 0x0800));
+			res.x = SubSat(res.x, Short4(0x0800));
+			res.y = SubSat(res.y, Short4(0x0800));
+			res.z = SubSat(res.z, Short4(0x0800));
 
 			res.x = AddSat(res.x, res.x);
 			res.y = AddSat(res.y, res.y);
@@ -667,9 +667,9 @@
 			{
 				Short4 tmp;
 
-				res.x = SubSat(arg1->x, Short4(0x0800, 0x0800, 0x0800, 0x0800)); tmp = SubSat(arg2->x, Short4(0x0800, 0x0800, 0x0800, 0x0800)); res.x = MulHigh(res.x, tmp);
-				res.y = SubSat(arg1->y, Short4(0x0800, 0x0800, 0x0800, 0x0800)); tmp = SubSat(arg2->y, Short4(0x0800, 0x0800, 0x0800, 0x0800)); res.y = MulHigh(res.y, tmp);
-				res.z = SubSat(arg1->z, Short4(0x0800, 0x0800, 0x0800, 0x0800)); tmp = SubSat(arg2->z, Short4(0x0800, 0x0800, 0x0800, 0x0800)); res.z = MulHigh(res.z, tmp);
+				res.x = SubSat(arg1->x, Short4(0x0800)); tmp = SubSat(arg2->x, Short4(0x0800)); res.x = MulHigh(res.x, tmp);
+				res.y = SubSat(arg1->y, Short4(0x0800)); tmp = SubSat(arg2->y, Short4(0x0800)); res.y = MulHigh(res.y, tmp);
+				res.z = SubSat(arg1->z, Short4(0x0800)); tmp = SubSat(arg2->z, Short4(0x0800)); res.z = MulHigh(res.z, tmp);
 
 				res.x = res.x << 6;
 				res.y = res.y << 6;
@@ -679,7 +679,7 @@
 				res.x = AddSat(res.x, res.z);
 
 				// Clamp to [0, 1]
-				res.x = Max(res.x, Short4(0x0000, 0x0000, 0x0000, 0x0000));
+				res.x = Max(res.x, Short4(0x0000));
 				res.x = Min(res.x, Short4(0x1000));
 
 				res.y = res.x;
@@ -794,7 +794,7 @@
 				L = MulHigh(L, *Pointer<Short4>(data + OFFSET(DrawData, textureStage[stage].luminanceScale4)));
 				L = L << 4;
 				L = AddSat(L, *Pointer<Short4>(data + OFFSET(DrawData, textureStage[stage].luminanceOffset4)));
-				L = Max(L, Short4(0x0000, 0x0000, 0x0000, 0x0000));
+				L = Max(L, Short4(0x0000));
 				L = Min(L, Short4(0x1000));
 
 				luminance = true;
@@ -940,11 +940,11 @@
 				break;
 			case TextureStage::STAGE_ADDSIGNED: // Arg1 + Arg2 - 0.5
 				res.w = AddSat(arg1->w, arg2->w);
-				res.w = SubSat(res.w, Short4(0x0800, 0x0800, 0x0800, 0x0800));
+				res.w = SubSat(res.w, Short4(0x0800));
 				break;
 			case TextureStage::STAGE_ADDSIGNED2X: // (Arg1 + Arg2 - 0.5) << 1
 				res.w = AddSat(arg1->w, arg2->w);
-				res.w = SubSat(res.w, Short4(0x0800, 0x0800, 0x0800, 0x0800));
+				res.w = SubSat(res.w, Short4(0x0800));
 				res.w = AddSat(res.w, res.w);
 				break;
 			case TextureStage::STAGE_SUBTRACT: // Arg1 - Arg2
@@ -1030,9 +1030,9 @@
 		case TextureStage::STAGE_ADDSIGNED2X:
 		case TextureStage::STAGE_SUBTRACT:
 		case TextureStage::STAGE_ADDSMOOTH:
-			res.x = Max(res.x, Short4(0x0000, 0x0000, 0x0000, 0x0000));
-			res.y = Max(res.y, Short4(0x0000, 0x0000, 0x0000, 0x0000));
-			res.z = Max(res.z, Short4(0x0000, 0x0000, 0x0000, 0x0000));
+			res.x = Max(res.x, Short4(0x0000));
+			res.y = Max(res.y, Short4(0x0000));
+			res.z = Max(res.z, Short4(0x0000));
 			break;
 		default:
 			ASSERT(false);
@@ -1071,7 +1071,7 @@
 		case TextureStage::STAGE_ADDSIGNED2X:
 		case TextureStage::STAGE_SUBTRACT:
 		case TextureStage::STAGE_ADDSMOOTH:
-			res.w = Max(res.w, Short4(0x0000, 0x0000, 0x0000, 0x0000));
+			res.w = Max(res.w, Short4(0x0000));
 			break;
 		default:
 			ASSERT(false);
@@ -1358,16 +1358,16 @@
 			mod.w = w;
 			break;
 		case Shader::MODIFIER_BIAS:
-			mod.x = SubSat(x, Short4(0x0800, 0x0800, 0x0800, 0x0800));
-			mod.y = SubSat(y, Short4(0x0800, 0x0800, 0x0800, 0x0800));
-			mod.z = SubSat(z, Short4(0x0800, 0x0800, 0x0800, 0x0800));
-			mod.w = SubSat(w, Short4(0x0800, 0x0800, 0x0800, 0x0800));
+			mod.x = SubSat(x, Short4(0x0800));
+			mod.y = SubSat(y, Short4(0x0800));
+			mod.z = SubSat(z, Short4(0x0800));
+			mod.w = SubSat(w, Short4(0x0800));
 			break;
 		case Shader::MODIFIER_BIAS_NEGATE:
-			mod.x = SubSat(Short4(0x0800, 0x0800, 0x0800, 0x0800), x);
-			mod.y = SubSat(Short4(0x0800, 0x0800, 0x0800, 0x0800), y);
-			mod.z = SubSat(Short4(0x0800, 0x0800, 0x0800, 0x0800), z);
-			mod.w = SubSat(Short4(0x0800, 0x0800, 0x0800, 0x0800), w);
+			mod.x = SubSat(Short4(0x0800), x);
+			mod.y = SubSat(Short4(0x0800), y);
+			mod.z = SubSat(Short4(0x0800), z);
+			mod.w = SubSat(Short4(0x0800), w);
 			break;
 		case Shader::MODIFIER_COMPLEMENT:
 			mod.x = SubSat(Short4(0x1000), x);
@@ -1394,20 +1394,20 @@
 			mod.w = -AddSat(w, w);
 			break;
 		case Shader::MODIFIER_SIGN:
-			mod.x = SubSat(x, Short4(0x0800, 0x0800, 0x0800, 0x0800));
-			mod.y = SubSat(y, Short4(0x0800, 0x0800, 0x0800, 0x0800));
-			mod.z = SubSat(z, Short4(0x0800, 0x0800, 0x0800, 0x0800));
-			mod.w = SubSat(w, Short4(0x0800, 0x0800, 0x0800, 0x0800));
+			mod.x = SubSat(x, Short4(0x0800));
+			mod.y = SubSat(y, Short4(0x0800));
+			mod.z = SubSat(z, Short4(0x0800));
+			mod.w = SubSat(w, Short4(0x0800));
 			mod.x = AddSat(mod.x, mod.x);
 			mod.y = AddSat(mod.y, mod.y);
 			mod.z = AddSat(mod.z, mod.z);
 			mod.w = AddSat(mod.w, mod.w);
 			break;
 		case Shader::MODIFIER_SIGN_NEGATE:
-			mod.x = SubSat(Short4(0x0800, 0x0800, 0x0800, 0x0800), x);
-			mod.y = SubSat(Short4(0x0800, 0x0800, 0x0800, 0x0800), y);
-			mod.z = SubSat(Short4(0x0800, 0x0800, 0x0800, 0x0800), z);
-			mod.w = SubSat(Short4(0x0800, 0x0800, 0x0800, 0x0800), w);
+			mod.x = SubSat(Short4(0x0800), x);
+			mod.y = SubSat(Short4(0x0800), y);
+			mod.z = SubSat(Short4(0x0800), z);
+			mod.w = SubSat(Short4(0x0800), w);
 			mod.x = AddSat(mod.x, mod.x);
 			mod.y = AddSat(mod.y, mod.y);
 			mod.z = AddSat(mod.z, mod.z);
@@ -1433,10 +1433,10 @@
 
 		if(src.type == Shader::PARAMETER_CONST && (src.modifier == Shader::MODIFIER_X2 || src.modifier == Shader::MODIFIER_X2_NEGATE))
 		{
-			mod.x = Min(mod.x, Short4(0x1000)); mod.x = Max(mod.x, Short4(-0x1000, -0x1000, -0x1000, -0x1000));
-			mod.y = Min(mod.y, Short4(0x1000)); mod.y = Max(mod.y, Short4(-0x1000, -0x1000, -0x1000, -0x1000));
-			mod.z = Min(mod.z, Short4(0x1000)); mod.z = Max(mod.z, Short4(-0x1000, -0x1000, -0x1000, -0x1000));
-			mod.w = Min(mod.w, Short4(0x1000)); mod.w = Max(mod.w, Short4(-0x1000, -0x1000, -0x1000, -0x1000));
+			mod.x = Min(mod.x, Short4(0x1000)); mod.x = Max(mod.x, Short4(-0x1000));
+			mod.y = Min(mod.y, Short4(0x1000)); mod.y = Max(mod.y, Short4(-0x1000));
+			mod.z = Min(mod.z, Short4(0x1000)); mod.z = Max(mod.z, Short4(-0x1000));
+			mod.w = Min(mod.w, Short4(0x1000)); mod.w = Max(mod.w, Short4(-0x1000));
 		}
 
 		return mod;
@@ -1551,7 +1551,7 @@
 		}
 		else
 		{
-			dst.x = Short4(0x0000, 0x0000, 0x0000, 0x0000);
+			dst.x = Short4(0x0000);
 		}
 
 		if(state.interpolant[2 + coordinate].component & 0x02)
@@ -1562,7 +1562,7 @@
 		}
 		else
 		{
-			dst.y = Short4(0x0000, 0x0000, 0x0000, 0x0000);
+			dst.y = Short4(0x0000);
 		}
 
 		if(state.interpolant[2 + coordinate].component & 0x04)
@@ -1573,7 +1573,7 @@
 		}
 		else
 		{
-			dst.z = Short4(0x0000, 0x0000, 0x0000, 0x0000);
+			dst.z = Short4(0x0000);
 		}
 
 		dst.w = Short4(0x1000);
@@ -1612,7 +1612,7 @@
 		}
 		else
 		{
-			dst.y = Short4(0x0000, 0x0000, 0x0000, 0x0000);
+			dst.y = Short4(0x0000);
 		}
 
 		if(state.interpolant[2 + coordinate].component & 0x04)
@@ -1624,7 +1624,7 @@
 		}
 		else
 		{
-			dst.z = Short4(0x0000, 0x0000, 0x0000, 0x0000);
+			dst.z = Short4(0x0000);
 		}
 	}
 
@@ -1734,7 +1734,7 @@
 		L = MulHigh(L, *Pointer<Short4>(data + OFFSET(DrawData, textureStage[stage].luminanceScale4)));
 		L = L << 4;
 		L = AddSat(L, *Pointer<Short4>(data + OFFSET(DrawData, textureStage[stage].luminanceOffset4)));
-		L = Max(L, Short4(0x0000, 0x0000, 0x0000, 0x0000));
+		L = Max(L, Short4(0x0000));
 		L = Min(L, Short4(0x1000));
 
 		dst.x = MulHigh(dst.x, L); dst.x = dst.x << 4;
@@ -1921,18 +1921,18 @@
 
 	void PixelPipeline::CND(Vector4s &dst, Vector4s &src0, Vector4s &src1, Vector4s &src2)
 	{
-		{ Short4 t0; t0 = src0.x; t0 = CmpGT(t0, Short4(0x0800, 0x0800, 0x0800, 0x0800)); Short4 t1; t1 = src1.x; t1 = t1 & t0; t0 = ~t0 & src2.x; t0 = t0 | t1; dst.x = t0; };
-		{Short4 t0; t0 = src0.y; t0 = CmpGT(t0, Short4(0x0800, 0x0800, 0x0800, 0x0800)); Short4 t1; t1 = src1.y; t1 = t1 & t0; t0 = ~t0 & src2.y; t0 = t0 | t1; dst.y = t0; };
-		{Short4 t0; t0 = src0.z; t0 = CmpGT(t0, Short4(0x0800, 0x0800, 0x0800, 0x0800)); Short4 t1; t1 = src1.z; t1 = t1 & t0; t0 = ~t0 & src2.z; t0 = t0 | t1; dst.z = t0; };
-		{Short4 t0; t0 = src0.w; t0 = CmpGT(t0, Short4(0x0800, 0x0800, 0x0800, 0x0800)); Short4 t1; t1 = src1.w; t1 = t1 & t0; t0 = ~t0 & src2.w; t0 = t0 | t1; dst.w = t0; };
+		{Short4 t0; t0 = src0.x; t0 = CmpGT(t0, Short4(0x0800)); Short4 t1; t1 = src1.x; t1 = t1 & t0; t0 = ~t0 & src2.x; t0 = t0 | t1; dst.x = t0; };
+		{Short4 t0; t0 = src0.y; t0 = CmpGT(t0, Short4(0x0800)); Short4 t1; t1 = src1.y; t1 = t1 & t0; t0 = ~t0 & src2.y; t0 = t0 | t1; dst.y = t0; };
+		{Short4 t0; t0 = src0.z; t0 = CmpGT(t0, Short4(0x0800)); Short4 t1; t1 = src1.z; t1 = t1 & t0; t0 = ~t0 & src2.z; t0 = t0 | t1; dst.z = t0; };
+		{Short4 t0; t0 = src0.w; t0 = CmpGT(t0, Short4(0x0800)); Short4 t1; t1 = src1.w; t1 = t1 & t0; t0 = ~t0 & src2.w; t0 = t0 | t1; dst.w = t0; };
 	}
 
 	void PixelPipeline::CMP(Vector4s &dst, Vector4s &src0, Vector4s &src1, Vector4s &src2)
 	{
-		{ Short4 t0 = CmpGT(Short4(0x0000, 0x0000, 0x0000, 0x0000), src0.x); Short4 t1; t1 = src2.x; t1 &= t0; t0 = ~t0 & src1.x; t0 |= t1; dst.x = t0; };
-		{Short4 t0 = CmpGT(Short4(0x0000, 0x0000, 0x0000, 0x0000), src0.y); Short4 t1; t1 = src2.y; t1 &= t0; t0 = ~t0 & src1.y; t0 |= t1; dst.y = t0; };
-		{Short4 t0 = CmpGT(Short4(0x0000, 0x0000, 0x0000, 0x0000), src0.z); Short4 t1; t1 = src2.z; t1 &= t0; t0 = ~t0 & src1.z; t0 |= t1; dst.z = t0; };
-		{Short4 t0 = CmpGT(Short4(0x0000, 0x0000, 0x0000, 0x0000), src0.w); Short4 t1; t1 = src2.w; t1 &= t0; t0 = ~t0 & src1.w; t0 |= t1; dst.w = t0; };
+		{Short4 t0 = CmpGT(Short4(0x0000), src0.x); Short4 t1; t1 = src2.x; t1 &= t0; t0 = ~t0 & src1.x; t0 |= t1; dst.x = t0; };
+		{Short4 t0 = CmpGT(Short4(0x0000), src0.y); Short4 t1; t1 = src2.y; t1 &= t0; t0 = ~t0 & src1.y; t0 |= t1; dst.y = t0; };
+		{Short4 t0 = CmpGT(Short4(0x0000), src0.z); Short4 t1; t1 = src2.z; t1 &= t0; t0 = ~t0 & src1.z; t0 |= t1; dst.z = t0; };
+		{Short4 t0 = CmpGT(Short4(0x0000), src0.w); Short4 t1; t1 = src2.w; t1 &= t0; t0 = ~t0 & src1.w; t0 |= t1; dst.w = t0; };
 	}
 
 	void PixelPipeline::BEM(Vector4s &dst, Vector4s &src0, Vector4s &src1, int stage)
diff --git a/src/Shader/PixelRoutine.cpp b/src/Shader/PixelRoutine.cpp
index c26e7ca..173561b 100644
--- a/src/Shader/PixelRoutine.cpp
+++ b/src/Shader/PixelRoutine.cpp
@@ -545,29 +545,29 @@
 			break;
 		case ALPHA_EQUAL:
 			cmp = CmpEQ(alpha, *Pointer<Short4>(data + OFFSET(DrawData,factor.alphaReference4)));
-			aMask = SignMask(Pack(cmp, Short4(0x0000, 0x0000, 0x0000, 0x0000)));
+			aMask = SignMask(Pack(cmp, Short4(0x0000)));
 			break;
-		case ALPHA_NOTEQUAL:		// a != b ~ !(a == b)
-			cmp = CmpEQ(alpha, *Pointer<Short4>(data + OFFSET(DrawData,factor.alphaReference4))) ^ Short4((short)0xFFFF, (short)0xFFFF, (short)0xFFFF, (short)0xFFFF);   // FIXME
-			aMask = SignMask(Pack(cmp, Short4(0x0000, 0x0000, 0x0000, 0x0000)));
+		case ALPHA_NOTEQUAL:       // a != b ~ !(a == b)
+			cmp = CmpEQ(alpha, *Pointer<Short4>(data + OFFSET(DrawData,factor.alphaReference4))) ^ Short4(0xFFFFu);   // FIXME
+			aMask = SignMask(Pack(cmp, Short4(0x0000)));
 			break;
-		case ALPHA_LESS:			// a < b ~ b > a
+		case ALPHA_LESS:           // a < b ~ b > a
 			cmp = CmpGT(*Pointer<Short4>(data + OFFSET(DrawData,factor.alphaReference4)), alpha);
-			aMask = SignMask(Pack(cmp, Short4(0x0000, 0x0000, 0x0000, 0x0000)));
+			aMask = SignMask(Pack(cmp, Short4(0x0000)));
 			break;
-		case ALPHA_GREATEREQUAL:	// a >= b ~ (a > b) || (a == b) ~ !(b > a)   // TODO: Approximate
+		case ALPHA_GREATEREQUAL:   // a >= b ~ (a > b) || (a == b) ~ !(b > a)   // TODO: Approximate
 			equal = CmpEQ(alpha, *Pointer<Short4>(data + OFFSET(DrawData,factor.alphaReference4)));
 			cmp = CmpGT(alpha, *Pointer<Short4>(data + OFFSET(DrawData,factor.alphaReference4)));
 			cmp |= equal;
-			aMask = SignMask(Pack(cmp, Short4(0x0000, 0x0000, 0x0000, 0x0000)));
+			aMask = SignMask(Pack(cmp, Short4(0x0000)));
 			break;
-		case ALPHA_LESSEQUAL:		// a <= b ~ !(a > b)
-			cmp = CmpGT(alpha, *Pointer<Short4>(data + OFFSET(DrawData,factor.alphaReference4))) ^ Short4((short)0xFFFF, (short)0xFFFF, (short)0xFFFF, (short)0xFFFF);   // FIXME
-			aMask = SignMask(Pack(cmp, Short4(0x0000, 0x0000, 0x0000, 0x0000)));
+		case ALPHA_LESSEQUAL:      // a <= b ~ !(a > b)
+			cmp = CmpGT(alpha, *Pointer<Short4>(data + OFFSET(DrawData,factor.alphaReference4))) ^ Short4(0xFFFFu);   // FIXME
+			aMask = SignMask(Pack(cmp, Short4(0x0000)));
 			break;
-		case ALPHA_GREATER:			// a > b
+		case ALPHA_GREATER:        // a > b
 			cmp = CmpGT(alpha, *Pointer<Short4>(data + OFFSET(DrawData,factor.alphaReference4)));
-			aMask = SignMask(Pack(cmp, Short4(0x0000, 0x0000, 0x0000, 0x0000)));
+			aMask = SignMask(Pack(cmp, Short4(0x0000)));
 			break;
 		default:
 			ASSERT(false);
@@ -1224,9 +1224,9 @@
 			current.z = pixel.z;
 			break;
 		case BLENDOP_NULL:
-			current.x = Short4(0x0000, 0x0000, 0x0000, 0x0000);
-			current.y = Short4(0x0000, 0x0000, 0x0000, 0x0000);
-			current.z = Short4(0x0000, 0x0000, 0x0000, 0x0000);
+			current.x = Short4(0x0000);
+			current.y = Short4(0x0000);
+			current.z = Short4(0x0000);
 			break;
 		default:
 			ASSERT(false);
@@ -1269,7 +1269,7 @@
 			current.w = pixel.w;
 			break;
 		case BLENDOP_NULL:
-			current.w = Short4(0x0000, 0x0000, 0x0000, 0x0000);
+			current.w = Short4(0x0000);
 			break;
 		default:
 			ASSERT(false);
@@ -1289,14 +1289,14 @@
 		switch(state.logicalOperation)
 		{
 		case LOGICALOP_CLEAR:
-			current.x = 0;
-			current.y = 0;
-			current.z = 0;
+			current.x = UShort4(0);
+			current.y = UShort4(0);
+			current.z = UShort4(0);
 			break;
 		case LOGICALOP_SET:
-			current.x = 0xFFFFu;
-			current.y = 0xFFFFu;
-			current.z = 0xFFFFu;
+			current.x = UShort4(0xFFFFu);
+			current.y = UShort4(0xFFFFu);
+			current.z = UShort4(0xFFFFu);
 			break;
 		case LOGICALOP_COPY:
 			ASSERT(false);   // Optimized out
@@ -1396,10 +1396,10 @@
 			case FORMAT_SRGB8_X8:
 			case FORMAT_SRGB8_A8:
 			case FORMAT_R8:
-				current.x = current.x - As<Short4>(As<UShort4>(current.x) >> 8) + Short4(0x0080, 0x0080, 0x0080, 0x0080);
-				current.y = current.y - As<Short4>(As<UShort4>(current.y) >> 8) + Short4(0x0080, 0x0080, 0x0080, 0x0080);
-				current.z = current.z - As<Short4>(As<UShort4>(current.z) >> 8) + Short4(0x0080, 0x0080, 0x0080, 0x0080);
-				current.w = current.w - As<Short4>(As<UShort4>(current.w) >> 8) + Short4(0x0080, 0x0080, 0x0080, 0x0080);
+				current.x = current.x - As<Short4>(As<UShort4>(current.x) >> 8) + Short4(0x0080);
+				current.y = current.y - As<Short4>(As<UShort4>(current.y) >> 8) + Short4(0x0080);
+				current.z = current.z - As<Short4>(As<UShort4>(current.z) >> 8) + Short4(0x0080);
+				current.w = current.w - As<Short4>(As<UShort4>(current.w) >> 8) + Short4(0x0080);
 				break;
 			default:
 				break;
diff --git a/src/Shader/SamplerCore.cpp b/src/Shader/SamplerCore.cpp
index 7c03dd4..fe14710 100644
--- a/src/Shader/SamplerCore.cpp
+++ b/src/Shader/SamplerCore.cpp
@@ -27,8 +27,8 @@
 		case sw::SWIZZLE_GREEN: s = c.y; break;
 		case sw::SWIZZLE_BLUE:  s = c.z; break;
 		case sw::SWIZZLE_ALPHA: s = c.w; break;
-		case sw::SWIZZLE_ZERO:  s = sw::Short4(0x0000, 0x0000, 0x0000, 0x0000); break;
-		case sw::SWIZZLE_ONE:   s = sw::Short4(0x1000, 0x1000, 0x1000, 0x1000); break;
+		case sw::SWIZZLE_ZERO:  s = sw::Short4(0x0000); break;
+		case sw::SWIZZLE_ONE:   s = sw::Short4(0x1000); break;
 		default: ASSERT(false);
 		}
 	}
@@ -76,17 +76,17 @@
 
 		if(state.textureType == TEXTURE_NULL)
 		{
-			c.x = Short4(0x0000, 0x0000, 0x0000, 0x0000);
-			c.y = Short4(0x0000, 0x0000, 0x0000, 0x0000);
-			c.z = Short4(0x0000, 0x0000, 0x0000, 0x0000);
+			c.x = Short4(0x0000);
+			c.y = Short4(0x0000);
+			c.z = Short4(0x0000);
 
 			if(fixed12)   // FIXME: Convert to fixed12 at higher level, when required
 			{
-				c.w = Short4(0x1000, 0x1000, 0x1000, 0x1000);
+				c.w = Short4(0x1000);
 			}
 			else
 			{
-				c.w = Short4((short)0xFFFF, (short)0xFFFF, (short)0xFFFF, (short)0xFFFF);   // FIXME
+				c.w = Short4(0xFFFFu);   // FIXME
 			}
 		}
 		else
@@ -237,21 +237,21 @@
 				case FORMAT_YV12_BT601:
 				case FORMAT_YV12_BT709:
 				case FORMAT_YV12_JFIF:
-					if(componentCount < 2) c.y = Short4(0x1000, 0x1000, 0x1000, 0x1000);
-					if(componentCount < 3) c.z = Short4(0x1000, 0x1000, 0x1000, 0x1000);
-					if(componentCount < 4) c.w = Short4(0x1000, 0x1000, 0x1000, 0x1000);
+					if(componentCount < 2) c.y = Short4(0x1000);
+					if(componentCount < 3) c.z = Short4(0x1000);
+					if(componentCount < 4) c.w = Short4(0x1000);
 					break;
 				case FORMAT_A8:
 					c.w = c.x;
-					c.x = Short4(0x0000, 0x0000, 0x0000, 0x0000);
-					c.y = Short4(0x0000, 0x0000, 0x0000, 0x0000);
-					c.z = Short4(0x0000, 0x0000, 0x0000, 0x0000);
+					c.x = Short4(0x0000);
+					c.y = Short4(0x0000);
+					c.z = Short4(0x0000);
 					break;
 				case FORMAT_L8:
 				case FORMAT_L16:
 					c.y = c.x;
 					c.z = c.x;
-					c.w = Short4(0x1000, 0x1000, 0x1000, 0x1000);
+					c.w = Short4(0x1000);
 					break;
 				case FORMAT_A8L8:
 					c.w = c.y;
@@ -259,11 +259,11 @@
 					c.z = c.x;
 					break;
 				case FORMAT_R32F:
-					c.y = Short4(0x1000, 0x1000, 0x1000, 0x1000);
+					c.y = Short4(0x1000);
 				case FORMAT_G32R32F:
-					c.z = Short4(0x1000, 0x1000, 0x1000, 0x1000);
+					c.z = Short4(0x1000);
 				case FORMAT_X32B32G32R32F:
-					c.w = Short4(0x1000, 0x1000, 0x1000, 0x1000);
+					c.w = Short4(0x1000);
 				case FORMAT_A32B32G32R32F:
 					break;
 				case FORMAT_D32F:
@@ -637,7 +637,7 @@
 			if(hasUnsignedTextureComponent(3)) cc.w = MulHigh(As<UShort4>(cc.w), utri); else cc.w = MulHigh(cc.w, stri);
 
 			utri = ~utri;
-			stri = Short4(0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF) - stri;
+			stri = Short4(0x7FFF) - stri;
 
 			if(hasUnsignedTextureComponent(0)) c.x = MulHigh(As<UShort4>(c.x), utri); else c.x = MulHigh(c.x, stri);
 			if(hasUnsignedTextureComponent(1)) c.y = MulHigh(As<UShort4>(c.y), utri); else c.y = MulHigh(c.y, stri);
@@ -724,10 +724,10 @@
 
 			Vector4s cSum;
 
-			cSum.x = Short4(0, 0, 0, 0);
-			cSum.y = Short4(0, 0, 0, 0);
-			cSum.z = Short4(0, 0, 0, 0);
-			cSum.w = Short4(0, 0, 0, 0);
+			cSum.x = Short4(0);
+			cSum.y = Short4(0);
+			cSum.z = Short4(0);
+			cSum.w = Short4(0);
 
 			Float4 A = *Pointer<Float4>(constants + OFFSET(Constants,uvWeight) + 16 * a);
 			Float4 B = *Pointer<Float4>(constants + OFFSET(Constants,uvStart) + 16 * a);
@@ -1752,8 +1752,8 @@
 				}
 			}
 			Short4 www2 = wwww;
-			wwww = As<Short4>(UnpackLow(wwww, Short4(0x0000, 0x0000, 0x0000, 0x0000)));
-			www2 = As<Short4>(UnpackHigh(www2, Short4(0x0000, 0x0000, 0x0000, 0x0000)));
+			wwww = As<Short4>(UnpackLow(wwww, Short4(0x0000)));
+			www2 = As<Short4>(UnpackHigh(www2, Short4(0x0000)));
 			wwww = As<Short4>(MulAdd(wwww, *Pointer<Short4>(mipmap + OFFSET(Mipmap,sliceP))));
 			www2 = As<Short4>(MulAdd(www2, *Pointer<Short4>(mipmap + OFFSET(Mipmap,sliceP))));
 			uuuu = As<Short4>(As<Int2>(uuuu) + As<Int2>(wwww));
@@ -1911,8 +1911,8 @@
 				case FORMAT_G8R8I_SNORM:
 				case FORMAT_V8U8:
 				case FORMAT_A8L8:
-					c.y = (c.x & Short4(0xFF00u, 0xFF00u, 0xFF00u, 0xFF00u)) | As<Short4>(As<UShort4>(c.x) >> 8);
-					c.x = (c.x & Short4(0x00FFu, 0x00FFu, 0x00FFu, 0x00FFu)) | (c.x << 8);
+					c.y = (c.x & Short4(0xFF00u)) | As<Short4>(As<UShort4>(c.x) >> 8);
+					c.x = (c.x & Short4(0x00FFu)) | (c.x << 8);
 					break;
 				default:
 					ASSERT(false);
@@ -2193,7 +2193,7 @@
 			convert -= Int4(0x00008000, 0x00008000, 0x00008000, 0x00008000);
 			convert = As<Int4>(Pack(convert, convert));
 
-			return As<Short4>(Int2(convert)) + Short4((short)0x8000, (short)0x8000, (short)0x8000, (short)0x8000);
+			return As<Short4>(Int2(convert)) + Short4(0x8000u);
 		}
 		else   // Wrap (or border)
 		{