expipart = LLVMBuildBitCast(builder, expipart, vec_type, "");
expfpart = lp_build_polynomial(bld, fpart, lp_build_exp2_polynomial,
- Elements(lp_build_exp2_polynomial));
+ ARRAY_SIZE(lp_build_exp2_polynomial));
res = LLVMBuildFMul(builder, expipart, expfpart, "");
/* compute P(z) */
logmant = lp_build_polynomial(bld, z, lp_build_log2_polynomial,
- Elements(lp_build_log2_polynomial));
+ ARRAY_SIZE(lp_build_log2_polynomial));
/* logmant = y * P(z) */
logmant = lp_build_mul(bld, y, logmant);
function = lp_build_const_func_pointer(gallivm,
func_to_pointer((func_pointer)lp_assert),
- ret_type, arg_types, Elements(arg_types),
+ ret_type, arg_types, ARRAY_SIZE(arg_types),
"assert");
/* build function call param list */
assert(LLVMTypeOf(args[0]) == arg_types[0]);
assert(LLVMTypeOf(args[1]) == arg_types[1]);
- LLVMBuildCall(builder, function, args, Elements(args), "");
+ LLVMBuildCall(builder, function, args, ARRAY_SIZE(args), "");
}
arg_types[2] = i32t;
arg_types[3] = i32t;
function_type = LLVMFunctionType(ret_type, arg_types,
- Elements(arg_types), 0);
+ ARRAY_SIZE(arg_types), 0);
/* make const pointer for the C fetch_rgba_8unorm function */
function = lp_build_const_int_pointer(gallivm,
args[3] = LLVMBuildExtractElement(builder, j, index, "");
}
- LLVMBuildCall(builder, function, args, Elements(args), "");
+ LLVMBuildCall(builder, function, args, ARRAY_SIZE(args), "");
tmp = LLVMBuildLoad(builder, tmp_ptr, "");
function = lp_build_const_func_pointer(gallivm,
func_to_pointer((func_pointer) format_desc->fetch_rgba_float),
ret_type,
- arg_types, Elements(arg_types),
+ arg_types, ARRAY_SIZE(arg_types),
format_desc->short_name);
}
args[3] = LLVMBuildExtractElement(builder, j, index, "");
}
- LLVMBuildCall(builder, function, args, Elements(args), "");
+ LLVMBuildCall(builder, function, args, ARRAY_SIZE(args), "");
tmps[k] = LLVMBuildLoad(builder, tmp_ptr, "");
}
indices[0] = lp_build_const_int32(gallivm, 0);
indices[1] = lp_build_const_int32(gallivm, LP_BUILD_FORMAT_CACHE_MEMBER_TAGS);
indices[2] = hash_index;
- ptr = LLVMBuildGEP(builder, cache, indices, Elements(indices), "");
+ ptr = LLVMBuildGEP(builder, cache, indices, ARRAY_SIZE(indices), "");
LLVMBuildStore(builder, tag_value, ptr);
indices[1] = lp_build_const_int32(gallivm, LP_BUILD_FORMAT_CACHE_MEMBER_DATA);
lp_build_const_int32(gallivm, 16), "");
for (count = 0; count < 4; count++) {
indices[2] = hash_index;
- ptr = LLVMBuildGEP(builder, cache, indices, Elements(indices), "");
+ ptr = LLVMBuildGEP(builder, cache, indices, ARRAY_SIZE(indices), "");
ptr = LLVMBuildBitCast(builder, ptr, type_ptr4x32, "");
LLVMBuildStore(builder, col[count], ptr);
hash_index = LLVMBuildAdd(builder, hash_index,
indices[0] = lp_build_const_int32(gallivm, 0);
indices[1] = lp_build_const_int32(gallivm, LP_BUILD_FORMAT_CACHE_MEMBER_DATA);
indices[2] = index;
- member_ptr = LLVMBuildGEP(builder, ptr, indices, Elements(indices), "");
+ member_ptr = LLVMBuildGEP(builder, ptr, indices, ARRAY_SIZE(indices), "");
return LLVMBuildLoad(builder, member_ptr, "cache_data");
}
indices[0] = lp_build_const_int32(gallivm, 0);
indices[1] = lp_build_const_int32(gallivm, LP_BUILD_FORMAT_CACHE_MEMBER_TAGS);
indices[2] = index;
- member_ptr = LLVMBuildGEP(builder, ptr, indices, Elements(indices), "");
+ member_ptr = LLVMBuildGEP(builder, ptr, indices, ARRAY_SIZE(indices), "");
return LLVMBuildLoad(builder, member_ptr, "tag_data");
}
arg_types[2] = i32t;
arg_types[3] = i32t;
function_type = LLVMFunctionType(ret_type, arg_types,
- Elements(arg_types), 0);
+ ARRAY_SIZE(arg_types), 0);
/* make const pointer for the C fetch_rgba_8unorm function */
function = lp_build_const_int_pointer(gallivm,
args[1] = ptr_addr;
args[2] = LLVMConstInt(i32t, i, 0);
args[3] = LLVMConstInt(i32t, j, 0);
- LLVMBuildCall(builder, function, args, Elements(args), "");
+ LLVMBuildCall(builder, function, args, ARRAY_SIZE(args), "");
}
}
args[2] = mask;
res = lp_build_intrinsic(builder, intrinsic,
- arg_type, args, Elements(args), 0);
+ arg_type, args, ARRAY_SIZE(args), 0);
if (arg_type != bld->vec_type) {
res = LLVMBuildBitCast(builder, res, bld->vec_type, "");
LLVMValueRef elems[LP_MAX_VECTOR_LENGTH];
unsigned i;
- assert(size <= Elements(elems));
+ assert(size <= ARRAY_SIZE(elems));
for (i = 0; i < size; ++i)
elems[i] = lp_build_const_int32(gallivm, i + start);
LLVMValueRef tmp[LP_MAX_VECTOR_LENGTH/2];
LLVMValueRef shuffles[LP_MAX_VECTOR_LENGTH];
- assert(src_type.length * num_vectors <= Elements(shuffles));
+ assert(src_type.length * num_vectors <= ARRAY_SIZE(shuffles));
assert(util_is_power_of_two(num_vectors));
new_length = src_type.length;
undef = LLVMGetUndef(type);
src_length = LLVMGetVectorSize(type);
- assert(dst_length <= Elements(elems));
+ assert(dst_length <= ARRAY_SIZE(elems));
assert(dst_length >= src_length);
if (src_length == dst_length)
int i;
argcount = lp_get_printf_arg_count(fmt);
- assert(Elements(params) >= argcount + 1);
+ assert(ARRAY_SIZE(params) >= argcount + 1);
va_start(arglist, fmt);
for (i = 1; i <= argcount; i++) {
assert(LLVMGetTypeKind(LLVMGetElementType(LLVMTypeOf(ptr))) == LLVMStructTypeKind);
indices[0] = lp_build_const_int32(gallivm, 0);
indices[1] = lp_build_const_int32(gallivm, member);
- member_ptr = LLVMBuildGEP(gallivm->builder, ptr, indices, Elements(indices), "");
+ member_ptr = LLVMBuildGEP(gallivm->builder, ptr, indices, ARRAY_SIZE(indices), "");
lp_build_name(member_ptr, "%s.%s_ptr", LLVMGetValueName(ptr), name);
return member_ptr;
}
assert(LLVMGetTypeKind(LLVMGetElementType(LLVMTypeOf(ptr))) == LLVMArrayTypeKind);
indices[0] = lp_build_const_int32(gallivm, 0);
indices[1] = index;
- element_ptr = LLVMBuildGEP(gallivm->builder, ptr, indices, Elements(indices), "");
+ element_ptr = LLVMBuildGEP(gallivm->builder, ptr, indices, ARRAY_SIZE(indices), "");
#ifdef DEBUG
lp_build_name(element_ptr, "&%s[%s]",
LLVMGetValueName(ptr), LLVMGetValueName(index));
if (!src->Indirect && !src->Absolute && !src->Negate) {
unsigned swizzle = tgsi_util_get_src_register_swizzle(src, chan);
if (src->File == TGSI_FILE_TEMPORARY) {
- if (src->Index < Elements(ctx->temp)) {
+ if (src->Index < ARRAY_SIZE(ctx->temp)) {
*chan_info = ctx->temp[src->Index][swizzle];
}
} else {
chan_info->file = src->File;
if (src->File == TGSI_FILE_IMMEDIATE) {
- assert(src->Index < Elements(ctx->imm));
- if (src->Index < Elements(ctx->imm)) {
+ assert(src->Index < ARRAY_SIZE(ctx->imm));
+ if (src->Index < ARRAY_SIZE(ctx->imm)) {
chan_info->u.value = ctx->imm[src->Index][swizzle];
}
} else {
struct lp_tgsi_info *info = ctx->info;
unsigned chan;
- if (info->num_texs < Elements(info->tex)) {
+ if (info->num_texs < ARRAY_SIZE(info->tex)) {
struct lp_tgsi_texture_info *tex_info = &info->tex[info->num_texs];
boolean indirect = FALSE;
unsigned readmask = 0;
struct lp_tgsi_info *info = ctx->info;
unsigned chan;
- if (info->num_texs < Elements(info->tex)) {
+ if (info->num_texs < ARRAY_SIZE(info->tex)) {
struct lp_tgsi_texture_info *tex_info = &info->tex[info->num_texs];
unsigned target = ctx->sample_target[inst->Src[1].Register.Index];
boolean indirect = FALSE;
if (dst->File == TGSI_FILE_TEMPORARY) {
regs = ctx->temp;
- max_regs = Elements(ctx->temp);
+ max_regs = ARRAY_SIZE(ctx->temp);
} else if (dst->File == TGSI_FILE_OUTPUT) {
regs = info->output;
- max_regs = Elements(info->output);
+ max_regs = ARRAY_SIZE(info->output);
} else if (dst->File == TGSI_FILE_ADDRESS ||
dst->File == TGSI_FILE_PREDICATE) {
continue;
const unsigned size =
parse.FullToken.FullImmediate.Immediate.NrTokens - 1;
assert(size <= 4);
- if (ctx->num_imms < Elements(ctx->imm)) {
+ if (ctx->num_imms < ARRAY_SIZE(ctx->imm)) {
for (chan = 0; chan < size; ++chan) {
float value = parse.FullToken.FullImmediate.u[chan].Float;
ctx->imm[ctx->num_imms][chan] = value;