gallivm: Fix trivial sign warnings

v2: include whitespace fixes

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
This commit is contained in:
Jan Vesely
2016-06-02 20:03:14 -04:00
parent a04804746f
commit ace70aedcf
8 changed files with 22 additions and 21 deletions

View File

@@ -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 &&

View File

@@ -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.

View File

@@ -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);

View File

@@ -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);

View File

@@ -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;
/*

View File

@@ -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,

View File

@@ -52,7 +52,7 @@
extern "C" {
#endif
#define LP_CHAN_ALL ~0
#define LP_CHAN_ALL ~0u
#define LP_MAX_INSTRUCTIONS 256

View File

@@ -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;
}