summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorJan Vesely <[email protected]>2016-06-02 20:03:14 -0400
committerJan Vesely <[email protected]>2016-06-13 09:23:09 -0400
commitace70aedcf8b29380a17f68a994b18f60976bca6 (patch)
tree6a52469550a1d4cf189941567dc4b9bf4dcba66b /src/gallium
parenta04804746f6d999905cda125a0778160d62c73a2 (diff)
gallivm: Fix trivial sign warnings
v2: include whitespace fixes Signed-off-by: Jan Vesely <[email protected]> Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_conv.c4
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_logic.c10
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_pack.c2
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_printf.c7
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_swizzle.c2
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_tgsi.c6
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_tgsi.h2
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c10
8 files changed, 22 insertions, 21 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_conv.c b/src/gallium/auxiliary/gallivm/lp_bld_conv.c
index 7cf0deece81..69d24a55bce 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_conv.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_conv.c
@@ -311,7 +311,7 @@ lp_build_clamped_float_to_unsigned_norm(struct gallivm_state *gallivm,
* important, we also get exact results for 0.0 and 1.0.
*/
- unsigned n = MIN2(src_type.width - 1, dst_width);
+ unsigned n = MIN2(src_type.width - 1u, dst_width);
double scale = (double)(1ULL << n);
unsigned lshift = dst_width - n;
@@ -445,7 +445,7 @@ int lp_build_conv_auto(struct gallivm_state *gallivm,
unsigned num_srcs,
LLVMValueRef *dst)
{
- int i;
+ unsigned i;
int num_dsts = num_srcs;
if (src_type.floating == dst_type->floating &&
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_logic.c b/src/gallium/auxiliary/gallivm/lp_bld_logic.c
index a26cc486003..14bf2369482 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_logic.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_logic.c
@@ -88,8 +88,6 @@ lp_build_compare_ext(struct gallivm_state *gallivm,
LLVMValueRef cond;
LLVMValueRef res;
- assert(func >= PIPE_FUNC_NEVER);
- assert(func <= PIPE_FUNC_ALWAYS);
assert(lp_check_value(type, a));
assert(lp_check_value(type, b));
@@ -98,6 +96,9 @@ lp_build_compare_ext(struct gallivm_state *gallivm,
if(func == PIPE_FUNC_ALWAYS)
return ones;
+ assert(func > PIPE_FUNC_NEVER);
+ assert(func < PIPE_FUNC_ALWAYS);
+
if(type.floating) {
LLVMRealPredicate op;
switch(func) {
@@ -176,8 +177,6 @@ lp_build_compare(struct gallivm_state *gallivm,
LLVMValueRef zeros = LLVMConstNull(int_vec_type);
LLVMValueRef ones = LLVMConstAllOnes(int_vec_type);
- assert(func >= PIPE_FUNC_NEVER);
- assert(func <= PIPE_FUNC_ALWAYS);
assert(lp_check_value(type, a));
assert(lp_check_value(type, b));
@@ -186,6 +185,9 @@ lp_build_compare(struct gallivm_state *gallivm,
if(func == PIPE_FUNC_ALWAYS)
return ones;
+ assert(func > PIPE_FUNC_NEVER);
+ assert(func < PIPE_FUNC_ALWAYS);
+
#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
/*
* There are no unsigned integer comparison instructions in SSE.
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_pack.c b/src/gallium/auxiliary/gallivm/lp_bld_pack.c
index 35b4c584699..b0e76e6465d 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_pack.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_pack.c
@@ -236,7 +236,7 @@ lp_build_concat_n(struct gallivm_state *gallivm,
unsigned num_dsts)
{
int size = num_srcs / num_dsts;
- int i;
+ unsigned i;
assert(num_srcs >= num_dsts);
assert((num_srcs % size) == 0);
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_printf.c b/src/gallium/auxiliary/gallivm/lp_bld_printf.c
index 14131b39105..575ebdfdf65 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_printf.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_printf.c
@@ -155,10 +155,10 @@ lp_build_print_value(struct gallivm_state *gallivm,
}
-static int
+static unsigned
lp_get_printf_arg_count(const char *fmt)
{
- int count =0;
+ unsigned count = 0;
const char *p = fmt;
int c;
@@ -195,8 +195,7 @@ lp_build_printf(struct gallivm_state *gallivm,
{
LLVMValueRef params[50];
va_list arglist;
- int argcount;
- int i;
+ unsigned argcount, i;
argcount = lp_get_printf_arg_count(fmt);
assert(ARRAY_SIZE(params) >= argcount + 1);
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c b/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c
index 92f387dc1b0..5a97c48ef85 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c
@@ -467,7 +467,7 @@ lp_build_swizzle_aos(struct lp_build_context *bld,
LLVMValueRef res;
struct lp_type type4;
unsigned cond = 0;
- unsigned chan;
+ int chan;
int shift;
/*
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.c
index 389cbebf0be..1ef6ae4268a 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.c
@@ -335,7 +335,7 @@ lp_build_emit_fetch(
enum tgsi_opcode_type stype = tgsi_opcode_infer_src_type(inst->Instruction.Opcode);
if (chan_index == LP_CHAN_ALL) {
- swizzle = ~0;
+ swizzle = ~0u;
} else {
swizzle = tgsi_util_get_full_src_register_swizzle(reg, chan_index);
if (swizzle > 3) {
@@ -398,7 +398,7 @@ lp_build_emit_fetch(
* Swizzle the argument
*/
- if (swizzle == ~0) {
+ if (swizzle == ~0u) {
res = bld_base->emit_swizzle(bld_base, res,
reg->Register.SwizzleX,
reg->Register.SwizzleY,
@@ -453,7 +453,7 @@ lp_build_emit_fetch_texoffset(
* Swizzle the argument
*/
- if (swizzle == ~0) {
+ if (swizzle == ~0u) {
res = bld_base->emit_swizzle(bld_base, res,
off->SwizzleX,
off->SwizzleY,
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
index b9094dcf597..de1150ccd18 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
@@ -52,7 +52,7 @@
extern "C" {
#endif
-#define LP_CHAN_ALL ~0
+#define LP_CHAN_ALL ~0u
#define LP_MAX_INSTRUCTIONS 256
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
index e3a2c4b215d..5b76733797b 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
@@ -642,7 +642,7 @@ static boolean default_analyse_is_last(struct lp_exec_mask *mask,
{
unsigned pc = bld_base->pc;
struct function_ctx *ctx = func_ctx(mask);
- unsigned curr_switch_stack = ctx->switch_stack_size;
+ int curr_switch_stack = ctx->switch_stack_size;
if (ctx->switch_stack_size > LP_MAX_TGSI_NESTING) {
return false;
@@ -653,7 +653,7 @@ static boolean default_analyse_is_last(struct lp_exec_mask *mask,
pc++;
}
- while (pc != -1 && pc < bld_base->num_instructions) {
+ while (pc != ~0u && pc < bld_base->num_instructions) {
unsigned opcode = bld_base->instructions[pc].Instruction.Opcode;
switch (opcode) {
case TGSI_OPCODE_CASE:
@@ -856,7 +856,7 @@ static void lp_exec_mask_endsub(struct lp_exec_mask *mask, int *pc)
static LLVMValueRef
get_file_ptr(struct lp_build_tgsi_soa_context *bld,
unsigned file,
- unsigned index,
+ int index,
unsigned chan)
{
LLVMBuilderRef builder = bld->bld_base.base.gallivm->builder;
@@ -1227,7 +1227,7 @@ emit_fetch_constant(
LLVMValueRef res;
/* XXX: Handle fetching xyzw components as a vector */
- assert(swizzle != ~0);
+ assert(swizzle != ~0u);
if (reg->Register.Dimension) {
assert(!reg->Dimension.Indirect);
@@ -2875,7 +2875,7 @@ emit_dump_file(struct lp_build_tgsi_soa_context *bld,
int chan;
if (index < 8 * sizeof(unsigned) &&
- (info->file_mask[file] & (1 << index)) == 0) {
+ (info->file_mask[file] & (1u << index)) == 0) {
/* This was not declared.*/
continue;
}