<commit_before>/* Copyright (c) 2001, Stanford University
 * All rights reserved
 *
 * See the file LICENSE.txt for information on redistributing this software.
 */

#include "tilesortspu.h"
#include "cr_error.h"
#include "cr_packfunctions.h"
#include "cr_glstate.h"
#include "cr_mem.h"

#define vmin(a,b) ((a)<(b)?(a):(b))

/* Ok.  So these might be major hacks 
** but the alternative is a huge switch statement
** and our protocol generator sorts the opcodes,
** so why not just do greater than less than?
*/
#define IS_VERTEX(a)	((a) >= CR_VERTEX2D_OPCODE && (a) <= CR_VERTEX4S_OPCODE)
#define IS_COLOR(a)		((a) >= CR_COLOR3B_OPCODE && (a) <= CR_COLOR4US_OPCODE)
#define IS_NORMAL(a)	((a) >= CR_NORMAL3B_OPCODE && (a) <= CR_NORMAL3S_OPCODE)
#define IS_INDEX(a)		((a) >= CR_INDEXD_OPCODE && (a) <= CR_INDEXS_OPCODE)
#define IS_TEXCOORD(a)	(((a) >= CR_TEXCOORD1D_OPCODE && (a) <= CR_TEXCOORD4S_OPCODE) || (((a) >= CR_MULTITEXCOORD1DARB_OPCODE) && ((a) <= CR_MULTITEXCOORD4SARB_OPCODE)))
#define IS_EDGEFLAG(a)	((a) == CR_EDGEFLAG_OPCODE)

#define ASSERT_BOUNDS(op, data) \
				CRASSERT(op <= thread->packer->buffer.opcode_start); \
				CRASSERT(op > thread->packer->buffer.opcode_end); \
				CRASSERT(data >= thread->packer->buffer.data_start); \
				CRASSERT(data < thread->packer->buffer.data_end)

static const GLvectorf vdefault = {0.0f, 0.0f, 0.0f, 1.0f};

void tilesortspuPinch (void) 
{
	GET_CONTEXT(ctx);
	CRCurrentState *c = &(ctx->current);
	int vtx_count = c->current->vtx_count - c->current->vtx_count_begin;
	int numRestore;
	int loop = 0;
	int wind = 0;
	unsigned int i, j;
	unsigned char * op;
	unsigned char * data;
	unsigned char * vtx_op;
	unsigned char * vtx_data;

	unsigned char *color_ptr = ctx->current.current->color.ptr;
	unsigned char *normal_ptr = ctx->current.current->normal.ptr;
	unsigned char *texCoord_ptr[CR_MAX_TEXTURE_UNITS];
	unsigned char *edgeFlag_ptr = ctx->current.current->edgeFlag.ptr;
	/* unsigned char *index_ptr = ctx->current.current->index.ptr; */
	CRVertex v_current;

	v_current.pos = vdefault;
	v_current.color = c->color;
	v_current.normal = c->normal;
	for (i = 0 ; i < ctx->limits.maxTextureUnits ; i++)
	{
		texCoord_ptr[i] = ctx->current.current->texCoord.ptr[i];
		v_current.texCoord[i] = c->texCoord[i];
	}
	v_current.edgeFlag = c->edgeFlag;
	v_current.index = c->index;

	/* First lets figure out how many vertices
	 * we need to recover.  Note to self --
	 * "vertexes" is NOT A WORD.
	 */
	if (!c->inBeginEnd || vtx_count == 0) 
	{
		thread->pinchState.numRestore = 0;
		return;
	}
	switch (c->mode) 
	{
		case GL_POINTS:
			numRestore = 0;
			break;
		case GL_LINES:
			numRestore = vtx_count % 2;<commit_msg>silence warnings about unused static __convert_* functions<commit_after>/* Copyright (c) 2001, Stanford University
 * All rights reserved
 *
 * See the file LICENSE.txt for information on redistributing this software.
 */

#include "tilesortspu.h"
#include "cr_error.h"
#include "cr_packfunctions.h"
#include "cr_glstate.h"
#include "cr_mem.h"

#define vmin(a,b) ((a)<(b)?(a):(b))

/* Ok.  So these might be major hacks 
** but the alternative is a huge switch statement
** and our protocol generator sorts the opcodes,
** so why not just do greater than less than?
*/
#define IS_VERTEX(a)	((a) >= CR_VERTEX2D_OPCODE && (a) <= CR_VERTEX4S_OPCODE)
#define IS_COLOR(a)		((a) >= CR_COLOR3B_OPCODE && (a) <= CR_COLOR4US_OPCODE)
#define IS_NORMAL(a)	((a) >= CR_NORMAL3B_OPCODE && (a) <= CR_NORMAL3S_OPCODE)
#define IS_INDEX(a)		((a) >= CR_INDEXD_OPCODE && (a) <= CR_INDEXS_OPCODE)
#define IS_TEXCOORD(a)	(((a) >= CR_TEXCOORD1D_OPCODE && (a) <= CR_TEXCOORD4S_OPCODE) || (((a) >= CR_MULTITEXCOORD1DARB_OPCODE) && ((a) <= CR_MULTITEXCOORD4SARB_OPCODE)))
#define IS_EDGEFLAG(a)	((a) == CR_EDGEFLAG_OPCODE)

#define ASSERT_BOUNDS(op, data) \
				CRASSERT(op <= thread->packer->buffer.opcode_start); \
				CRASSERT(op > thread->packer->buffer.opcode_end); \
				CRASSERT(data >= thread->packer->buffer.data_start); \
				CRASSERT(data < thread->packer->buffer.data_end)

static const GLvectorf vdefault = {0.0f, 0.0f, 0.0f, 1.0f};

void tilesortspuPinch (void) 
{
	GET_CONTEXT(ctx);
	CRCurrentState *c = &(ctx->current);
	int vtx_count = c->current->vtx_count - c->current->vtx_count_begin;
	int numRestore;
	int loop = 0;
	int wind = 0;
	unsigned int i, j;
	unsigned char * op;
	unsigned char * data;
	unsigned char * vtx_op;
	unsigned char * vtx_data;

	unsigned char *color_ptr = ctx->current.current->color.ptr;
	unsigned char *normal_ptr = ctx->current.current->normal.ptr;
	unsigned char *texCoord_ptr[CR_MAX_TEXTURE_UNITS];
	unsigned char *edgeFlag_ptr = ctx->current.current->edgeFlag.ptr;
	/* unsigned char *index_ptr = ctx->current.current->index.ptr; */
	CRVertex v_current;

	/* silence warnings */
	(void) __convert_b1;
	(void) __convert_b2;
	(void) __convert_b3;
	(void) __convert_b4;
	(void) __convert_ui1;
	(void) __convert_ui2;
	(void) __convert_ui3;
	(void) __convert_ui4;
	(void) __convert_l1;
	(void) __convert_l2;
	(void) __convert_l3;
	(void) __convert_l4;
	(void) __convert_us1;
	(void) __convert_us2;
	(void) __convert_us3;
	(void) __convert_us4;
	(void) __convert_ub1;
	(void) __convert_ub2;
	(void) __convert_ub3;
	(void) __convert_ub4;
	(void) __convert_rescale_s1;
	(void) __convert_rescale_s2;
	(void) __convert_rescale_b1;
	(void) __convert_rescale_b2;
	(void) __convert_rescale_ui1;
	(void) __convert_rescale_ui2;
	(void) __convert_rescale_i1;
	(void) __convert_rescale_i2;
	(void) __convert_rescale_us1;
	(void) __convert_rescale_us2;
	(void) __convert_rescale_ub1;
	(void) __convert_rescale_ub2;
	(void) __convert_boolean;

	v_current.pos = vdefault;
	v_current.color = c->color;
	v_current.normal = c->normal;
	for (i = 0 ; i < ctx->limits.maxTextureUnits ; i++)
	{
		texCoord_ptr[i] = ctx->current.current->texCoord.ptr[i];
		v_current.texCoord[i] = c->texCoord[i];
	}
	v_current.edgeFlag = c->edgeFlag;
	v_current.index = c->index;

	/* First lets figure out how many vertices
	 * we need to recover.  Note to self --
	 * "vertexes" is NOT A WORD.
	 */
	if (!c->inBeginEnd || vtx_count == 0) 
	{
		thread->pinchState.numRestore = 0;
		return;
	}
	switch (c->mode) 
	{
		case GL_POINTS:
			numRestore = 0;
			break;
		case GL_LINES:
			numRestore = vtx_count % 2;
{'fraction_non_alphanumeric': 0.14730787665761302, 'fraction_numerical': 0.014379293816903659, 'mean_word_length': 4.701275045537341, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 83, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2248055', 'n_tokens_mistral': 2591, 'n_tokens_neox': 2510, 'n_words': 541}