Skip to content

Commit

Permalink
Replace macro max and min, by some inline functions :
Browse files Browse the repository at this point in the history
-To avoid having long operation repeated twice, peoples shouldn'tuse long operation into does macro but they do so...
-To avoid double increment or thing like such.
-Yes this involve some implicite cast sometime, but that still better then redo 10 dereference...
  • Loading branch information
lighta committed Oct 21, 2015
1 parent b480cb3 commit 214ff17
Show file tree
Hide file tree
Showing 20 changed files with 156 additions and 137 deletions.
28 changes: 14 additions & 14 deletions src/char/char.c
Expand Up @@ -1550,7 +1550,7 @@ int char_delete_char_sql(uint32 char_id){
Sql_GetData(sql_handle, 8, &data, NULL); mother_id = atoi(data);
Sql_GetData(sql_handle, 9, &data, NULL); elemental_id = atoi(data);

Sql_EscapeStringLen(sql_handle, esc_name, name, min(len, NAME_LENGTH));
Sql_EscapeStringLen(sql_handle, esc_name, name, zmin(len, NAME_LENGTH));
Sql_FreeResult(sql_handle);

//check for config char del condition [Lupus]
Expand Down Expand Up @@ -1715,16 +1715,16 @@ int char_mmo_char_tobuf(uint8* buffer, struct mmo_charstatus* p)

buf = WBUFP(buffer,0);
WBUFL(buf,0) = p->char_id;
WBUFL(buf,4) = min(p->base_exp, INT32_MAX);
WBUFL(buf,4) = umin(p->base_exp, INT32_MAX);
WBUFL(buf,8) = p->zeny;
WBUFL(buf,12) = min(p->job_exp, INT32_MAX);
WBUFL(buf,12) = umin(p->job_exp, INT32_MAX);
WBUFL(buf,16) = p->job_level;
WBUFL(buf,20) = 0; // probably opt1
WBUFL(buf,24) = 0; // probably opt2
WBUFL(buf,28) = p->option;
WBUFL(buf,32) = p->karma;
WBUFL(buf,36) = p->manner;
WBUFW(buf,40) = min(p->status_point, INT16_MAX);
WBUFW(buf,40) = umin(p->status_point, INT16_MAX);
WBUFL(buf,42) = p->hp;
WBUFL(buf,46) = p->max_hp;
offset+=4;
Expand All @@ -1745,20 +1745,20 @@ int char_mmo_char_tobuf(uint8* buffer, struct mmo_charstatus* p)
WBUFW(buf,56) = p->option&(0x20|0x80000|0x100000|0x200000|0x400000|0x800000|0x1000000|0x2000000|0x4000000|0x8000000) ? 0 : p->weapon;

WBUFW(buf,58) = p->base_level;
WBUFW(buf,60) = min(p->skill_point, INT16_MAX);
WBUFW(buf,60) = umin(p->skill_point, INT16_MAX);
WBUFW(buf,62) = p->head_bottom;
WBUFW(buf,64) = p->shield;
WBUFW(buf,66) = p->head_top;
WBUFW(buf,68) = p->head_mid;
WBUFW(buf,70) = p->hair_color;
WBUFW(buf,72) = p->clothes_color;
memcpy(WBUFP(buf,74), p->name, NAME_LENGTH);
WBUFB(buf,98) = min(p->str, UINT8_MAX);
WBUFB(buf,99) = min(p->agi, UINT8_MAX);
WBUFB(buf,100) = min(p->vit, UINT8_MAX);
WBUFB(buf,101) = min(p->int_, UINT8_MAX);
WBUFB(buf,102) = min(p->dex, UINT8_MAX);
WBUFB(buf,103) = min(p->luk, UINT8_MAX);
WBUFB(buf,98) = u16min(p->str, UINT8_MAX);
WBUFB(buf,99) = u16min(p->agi, UINT8_MAX);
WBUFB(buf,100) = u16min(p->vit, UINT8_MAX);
WBUFB(buf,101) = u16min(p->int_, UINT8_MAX);
WBUFB(buf,102) = u16min(p->dex, UINT8_MAX);
WBUFB(buf,103) = u16min(p->luk, UINT8_MAX);
WBUFW(buf,104) = p->slot;
WBUFW(buf,106) = ( p->rename > 0 ) ? 0 : 1;
offset += 2;
Expand Down Expand Up @@ -1956,7 +1956,7 @@ void char_read_fame_list(void)
smith_fame_list[i].fame = atoi(data);
// name
Sql_GetData(sql_handle, 2, &data, &len);
memcpy(smith_fame_list[i].name, data, min(len, NAME_LENGTH));
memcpy(smith_fame_list[i].name, data, zmin(len, NAME_LENGTH));
}
// Build Alchemist ranking list
if( SQL_ERROR == Sql_Query(sql_handle, "SELECT `char_id`,`fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d' OR `class`='%d') ORDER BY `fame` DESC LIMIT 0,%d", schema_config.char_db, JOB_ALCHEMIST, JOB_CREATOR, JOB_BABY_ALCHEMIST, JOB_GENETIC, JOB_GENETIC_T, JOB_BABY_GENETIC, fame_list_size_chemist) )
Expand All @@ -1971,7 +1971,7 @@ void char_read_fame_list(void)
chemist_fame_list[i].fame = atoi(data);
// name
Sql_GetData(sql_handle, 2, &data, &len);
memcpy(chemist_fame_list[i].name, data, min(len, NAME_LENGTH));
memcpy(chemist_fame_list[i].name, data, zmin(len, NAME_LENGTH));
}
// Build Taekwon ranking list
if( SQL_ERROR == Sql_Query(sql_handle, "SELECT `char_id`,`fame`,`name` FROM `%s` WHERE `fame`>0 AND (`class`='%d') ORDER BY `fame` DESC LIMIT 0,%d", schema_config.char_db, JOB_TAEKWON, fame_list_size_taekwon) )
Expand All @@ -1986,7 +1986,7 @@ void char_read_fame_list(void)
taekwon_fame_list[i].fame = atoi(data);
// name
Sql_GetData(sql_handle, 2, &data, &len);
memcpy(taekwon_fame_list[i].name, data, min(len, NAME_LENGTH));
memcpy(taekwon_fame_list[i].name, data, zmin(len, NAME_LENGTH));
}
Sql_FreeResult(sql_handle);
}
Expand Down
18 changes: 9 additions & 9 deletions src/char/int_guild.c
Expand Up @@ -362,8 +362,8 @@ struct guild * inter_guild_fromsql(int guild_id)
CREATE(g, struct guild, 1);

g->guild_id = guild_id;
Sql_GetData(sql_handle, 0, &data, &len); memcpy(g->name, data, min(len, NAME_LENGTH));
Sql_GetData(sql_handle, 1, &data, &len); memcpy(g->master, data, min(len, NAME_LENGTH));
Sql_GetData(sql_handle, 0, &data, &len); memcpy(g->name, data, zmin(len, NAME_LENGTH));
Sql_GetData(sql_handle, 1, &data, &len); memcpy(g->master, data, zmin(len, NAME_LENGTH));
Sql_GetData(sql_handle, 2, &data, NULL); g->guild_lv = atoi(data);
Sql_GetData(sql_handle, 3, &data, NULL); g->connect_member = atoi(data);
Sql_GetData(sql_handle, 4, &data, NULL); g->max_member = atoi(data);
Expand All @@ -376,8 +376,8 @@ struct guild * inter_guild_fromsql(int guild_id)
Sql_GetData(sql_handle, 6, &data, NULL); g->exp = strtoull(data, NULL, 10);
Sql_GetData(sql_handle, 7, &data, NULL); g->next_exp = (unsigned int)strtoul(data, NULL, 10);
Sql_GetData(sql_handle, 8, &data, NULL); g->skill_point = atoi(data);
Sql_GetData(sql_handle, 9, &data, &len); memcpy(g->mes1, data, min(len, sizeof(g->mes1)));
Sql_GetData(sql_handle, 10, &data, &len); memcpy(g->mes2, data, min(len, sizeof(g->mes2)));
Sql_GetData(sql_handle, 9, &data, &len); memcpy(g->mes1, data, zmin(len, sizeof(g->mes1)));
Sql_GetData(sql_handle, 10, &data, &len); memcpy(g->mes2, data, zmin(len, sizeof(g->mes2)));
Sql_GetData(sql_handle, 11, &data, &len); g->emblem_len = atoi(data);
Sql_GetData(sql_handle, 12, &data, &len); g->emblem_id = atoi(data);
Sql_GetData(sql_handle, 13, &data, &len);
Expand Down Expand Up @@ -428,7 +428,7 @@ struct guild * inter_guild_fromsql(int guild_id)
Sql_GetData(sql_handle, 10, &data, NULL); m->position = atoi(data);
if( m->position >= MAX_GUILDPOSITION ) // Fix reduction of MAX_GUILDPOSITION [PoW]
m->position = MAX_GUILDPOSITION - 1;
Sql_GetData(sql_handle, 11, &data, &len); memcpy(m->name, data, min(len, NAME_LENGTH));
Sql_GetData(sql_handle, 11, &data, &len); memcpy(m->name, data, zmin(len, NAME_LENGTH));
m->modified = GS_MEMBER_UNMODIFIED;
}

Expand All @@ -448,7 +448,7 @@ struct guild * inter_guild_fromsql(int guild_id)
if( position < 0 || position >= MAX_GUILDPOSITION )
continue;// invalid position
gpos = &g->position[position];
Sql_GetData(sql_handle, 1, &data, &len); memcpy(gpos->name, data, min(len, NAME_LENGTH));
Sql_GetData(sql_handle, 1, &data, &len); memcpy(gpos->name, data, zmin(len, NAME_LENGTH));
Sql_GetData(sql_handle, 2, &data, NULL); gpos->mode = atoi(data);
Sql_GetData(sql_handle, 3, &data, NULL); gpos->exp_mode = atoi(data);
gpos->modified = GS_POSITION_UNMODIFIED;
Expand All @@ -467,7 +467,7 @@ struct guild * inter_guild_fromsql(int guild_id)

Sql_GetData(sql_handle, 0, &data, NULL); a->opposition = atoi(data);
Sql_GetData(sql_handle, 1, &data, NULL); a->guild_id = atoi(data);
Sql_GetData(sql_handle, 2, &data, &len); memcpy(a->name, data, min(len, NAME_LENGTH));
Sql_GetData(sql_handle, 2, &data, &len); memcpy(a->name, data, zmin(len, NAME_LENGTH));
}

//printf("- Read guild_expulsion %d from sql \n",guild_id);
Expand All @@ -482,8 +482,8 @@ struct guild * inter_guild_fromsql(int guild_id)
struct guild_expulsion *e = &g->expulsion[i];

Sql_GetData(sql_handle, 0, &data, NULL); e->account_id = atoi(data);
Sql_GetData(sql_handle, 1, &data, &len); memcpy(e->name, data, min(len, NAME_LENGTH));
Sql_GetData(sql_handle, 2, &data, &len); memcpy(e->mes, data, min(len, sizeof(e->mes)));
Sql_GetData(sql_handle, 1, &data, &len); memcpy(e->name, data, zmin(len, NAME_LENGTH));
Sql_GetData(sql_handle, 2, &data, &len); memcpy(e->mes, data, zmin(len, sizeof(e->mes)));
}

//printf("- Read guild_skill %d from sql \n",guild_id);
Expand Down
2 changes: 1 addition & 1 deletion src/char/int_homun.c
Expand Up @@ -195,7 +195,7 @@ bool mapif_homunculus_load(int homun_id, struct s_homunculus* hd)
Sql_GetData(sql_handle, 21, &data, NULL); hd->vaporize = atoi(data);
Sql_FreeResult(sql_handle);

hd->intimacy = min(hd->intimacy,100000);
hd->intimacy = umin(hd->intimacy,100000);
hd->hunger = cap_value(hd->hunger, 0, 100);

// Load Homunculus Skill
Expand Down
4 changes: 2 additions & 2 deletions src/char/int_party.c
Expand Up @@ -217,7 +217,7 @@ struct party_data *inter_party_fromsql(int party_id)
return NULL;

p->party.party_id = party_id;
Sql_GetData(sql_handle, 1, &data, &len); memcpy(p->party.name, data, min(len, NAME_LENGTH));
Sql_GetData(sql_handle, 1, &data, &len); memcpy(p->party.name, data, zmin(len, NAME_LENGTH));
Sql_GetData(sql_handle, 2, &data, NULL); p->party.exp = (atoi(data) ? 1 : 0);
Sql_GetData(sql_handle, 3, &data, NULL); p->party.item = atoi(data);
Sql_GetData(sql_handle, 4, &data, NULL); leader_id = atoi(data);
Expand All @@ -235,7 +235,7 @@ struct party_data *inter_party_fromsql(int party_id)
m = &p->party.member[i];
Sql_GetData(sql_handle, 0, &data, NULL); m->account_id = atoi(data);
Sql_GetData(sql_handle, 1, &data, NULL); m->char_id = atoi(data);
Sql_GetData(sql_handle, 2, &data, &len); memcpy(m->name, data, min(len, NAME_LENGTH));
Sql_GetData(sql_handle, 2, &data, &len); memcpy(m->name, data, zmin(len, NAME_LENGTH));
Sql_GetData(sql_handle, 3, &data, NULL); m->lv = atoi(data);
Sql_GetData(sql_handle, 4, &data, NULL); m->map = mapindex_name2id(data);
Sql_GetData(sql_handle, 5, &data, NULL); m->online = (atoi(data) ? 1 : 0);
Expand Down
2 changes: 1 addition & 1 deletion src/char/int_pet.c
Expand Up @@ -76,7 +76,7 @@ int inter_pet_fromsql(int pet_id, struct s_pet* p)
{
p->pet_id = pet_id;
Sql_GetData(sql_handle, 1, &data, NULL); p->class_ = atoi(data);
Sql_GetData(sql_handle, 2, &data, &len); memcpy(p->name, data, min(len, NAME_LENGTH));
Sql_GetData(sql_handle, 2, &data, &len); memcpy(p->name, data, zmin(len, NAME_LENGTH));
Sql_GetData(sql_handle, 3, &data, NULL); p->account_id = atoi(data);
Sql_GetData(sql_handle, 4, &data, NULL); p->char_id = atoi(data);
Sql_GetData(sql_handle, 5, &data, NULL); p->level = atoi(data);
Expand Down
2 changes: 1 addition & 1 deletion src/char/inter.c
Expand Up @@ -1040,7 +1040,7 @@ int mapif_parse_WisRequest(int fd)
// to be sure of the correct name, rewrite it
Sql_GetData(sql_handle, 0, &data, &len);
memset(name, 0, NAME_LENGTH);
memcpy(name, data, min(len, NAME_LENGTH));
memcpy(name, data, zmin(len, NAME_LENGTH));
// if source is destination, don't ask other servers.
if( strncmp((const char*)RFIFOP(fd,4), name, NAME_LENGTH) == 0 )
{
Expand Down
40 changes: 31 additions & 9 deletions src/common/cbasetypes.h
Expand Up @@ -286,14 +286,6 @@ typedef char bool;
#define swap(a,b) if (a != b) ((a ^= b), (b ^= a), (a ^= b))
#define swap_ptr(a,b) if ((a) != (b)) ((a) = (void*)((intptr_t)(a) ^ (intptr_t)(b)), (b) = (void*)((intptr_t)(a) ^ (intptr_t)(b)), (a) = (void*)((intptr_t)(a) ^ (intptr_t)(b)))

#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif

#ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif

//////////////////////////////////////////////////////////////////////////
// should not happen
#ifndef NULL
Expand Down Expand Up @@ -358,7 +350,7 @@ typedef char bool;
#define TOUPPER(c) (toupper((unsigned char)(c)))

//////////////////////////////////////////////////////////////////////////
// length of a static array
// length of a static array (size_t)
#define ARRAYLENGTH(A) ( sizeof(A)/sizeof((A)[0]) )

//////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -404,5 +396,35 @@ void SET_FUNCPOINTER(T1& var, T2 p)
#define SET_FUNCPOINTER(var,p) (var) = (p)
#endif

//#ifndef max
//#define max(a,b) (((a) > (b)) ? (a) : (b))
//wish we could have template in C
static inline int max(int a, int b){ return (a > b) ? a : b; } //default is int
static inline int8 i8max(int8 a, int8 b){ return (a > b) ? a : b; }
static inline int16 i16max(int16 a, int16 b){ return (a > b) ? a : b; }
static inline int32 i32max(int32 a, int32 b){ return (a > b) ? a : b; }
static inline int64 i64max(int64 a, int64 b){ return (a > b) ? a : b; }
static inline uint32 umax(uint32 a, uint32 b){ return (a > b) ? a : b; }
static inline uint8 u8max(uint8 a, uint8 b){ return (a > b) ? a : b; }
static inline uint16 u16max(uint16 a, uint16 b){ return (a > b) ? a : b; }
static inline uint32 u32max(uint32 a, uint32 b){ return (a > b) ? a : b; }
static inline uint64 u64max(uint64 a, uint64 b){ return (a > b) ? a : b; }
static inline size_t zmax(size_t a, size_t b){ return (a > b) ? a : b; } //cause those varie
//#endif

//#ifndef min
//#define min(a,b) (((a) < (b)) ? (a) : (b))
//#endif
static inline int min(int a, int b){ return (a < b) ? a : b; } //default is int
static inline int8 i8min(int8 a, int8 b){ return (a < b) ? a : b; }
static inline int16 i16min(int16 a, int16 b){ return (a < b) ? a : b; }
static inline int32 i32min(int32 a, int32 b){ return (a < b) ? a : b; }
static inline int64 i64min(int64 a, int64 b){ return (a < b) ? a : b; }
static inline uint32 umin(uint32 a, uint32 b){ return (a < b) ? a : b; }
static inline uint8 u8min(uint8 a, uint8 b){ return (a < b) ? a : b; }
static inline uint16 u16min(uint16 a, uint16 b){ return (a < b) ? a : b; }
static inline uint32 u32min(uint32 a, uint32 b){ return (a < b) ? a : b; }
static inline uint64 u64min(uint64 a, uint64 b){ return (a < b) ? a : b; }
static inline size_t zmin(size_t a, size_t b){ return (a < b) ? a : b; }

#endif /* _CBASETYPES_H_ */
2 changes: 1 addition & 1 deletion src/common/mapindex.c
Expand Up @@ -33,7 +33,7 @@ const char* mapindex_getmapname(const char* string, char* output) {
if (len >= 4 && stricmp(&string[len-4], ".gat") == 0)
len -= 4; // strip .gat extension

len = min(len, MAP_NAME_LENGTH-1);
len = zmin(len, MAP_NAME_LENGTH-1);
safestrncpy(dest, string, len+1);
memset(&dest[len], '\0', MAP_NAME_LENGTH-len);

Expand Down
7 changes: 4 additions & 3 deletions src/map/atcommand.c
Expand Up @@ -3322,11 +3322,11 @@ ACMD_FUNC(lostskill)
*------------------------------------------*/
ACMD_FUNC(spiritball)
{
int max_spiritballs;
uint32 max_spiritballs;
int number;
nullpo_retr(-1, sd);

max_spiritballs = min(ARRAYLENGTH(sd->spirit_timer), 0x7FFF);
max_spiritballs = zmin(ARRAYLENGTH(sd->spirit_timer), 0x7FFF);

if( !message || !*message || (number = atoi(message)) < 0 || number > max_spiritballs )
{
Expand Down Expand Up @@ -3854,8 +3854,9 @@ ACMD_FUNC(partysharelvl) {
if(!message || !*message) {
clif_displaymessage(fd, msg_txt(sd,1322)); // Please enter an amount.
return -1;
} else
} else {
share_lvl = min(abs(atoi(message)),MAX_LEVEL);
}

if(intif_party_sharelvlupdate(share_lvl)) //Successfully updated
clif_displaymessage(fd, msg_txt(sd,1478)); // Party share level range has been changed successfully.
Expand Down
18 changes: 8 additions & 10 deletions src/map/battle.c
Expand Up @@ -492,7 +492,7 @@ int64 battle_attr_fix(struct block_list *src, struct block_list *target, int64 d
else
damage = damage + (damage * (ratio - 100) / 100);

return max(damage,0);
return i64max(damage,0);
}

/**
Expand Down Expand Up @@ -1470,7 +1470,7 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam
if (flag & BF_LONG)
damage = damage * battle_config.pk_long_damage_rate / 100;
}
damage = max(damage,1);
damage = i64max(damage,1);
}

if(battle_config.skill_min_damage && damage > 0 && damage < div_) {
Expand Down Expand Up @@ -1550,7 +1550,7 @@ int64 battle_calc_bg_damage(struct block_list *src, struct block_list *bl, int64
damage = damage * battle_config.bg_long_damage_rate / 100;
}

damage = max(damage,1); //min 1 damage
damage = i64max(damage,1); //min 1 damage
return damage;
}

Expand Down Expand Up @@ -1619,7 +1619,7 @@ int64 battle_calc_gvg_damage(struct block_list *src,struct block_list *bl,int64
if (flag & BF_LONG)
damage = damage * battle_config.gvg_long_damage_rate / 100;
}
damage = max(damage,1);
damage = i64max(damage,1);
return damage;
}

Expand Down Expand Up @@ -4478,7 +4478,6 @@ struct Damage battle_calc_defense_reduction(struct Damage wd, struct block_list

if (sd) {
int i = sd->ignore_def_by_race[tstatus->race] + sd->ignore_def_by_race[RC_ALL];

if (i) {
i = min(i,100); //cap it to 100 for 0 def min
def1 -= def1 * i / 100;
Expand All @@ -4487,9 +4486,8 @@ struct Damage battle_calc_defense_reduction(struct Damage wd, struct block_list

//Kagerou/Oboro Earth Charm effect +10% eDEF
if(sd->spiritcharm_type == CHARM_TYPE_LAND && sd->spiritcharm > 0) {
short i = 10 * sd->spiritcharm;

def1 = (def1 * (100 + i)) / 100;
short si = 10 * sd->spiritcharm;
def1 = (def1 * (100 + si)) / 100;
}
}

Expand Down Expand Up @@ -6665,7 +6663,7 @@ int64 battle_calc_return_damage(struct block_list* bl, struct block_list *src, i
if (flag & BF_SHORT) {//Bounces back part of the damage.
if ( !status_reflect && sd && sd->bonus.short_weapon_damage_return ) {
rdamage += damage * sd->bonus.short_weapon_damage_return / 100;
rdamage = max(rdamage,1);
rdamage = i64max(rdamage,1);
} else if( status_reflect && sc && sc->count ) {
if( sc->data[SC_REFLECTSHIELD] ) {
struct status_change_entry *sce_d;
Expand Down Expand Up @@ -6731,7 +6729,7 @@ int64 battle_calc_return_damage(struct block_list* bl, struct block_list *src, i
#ifdef RENEWAL
rdamage = cap_value(rdamage, 1, max_damage);
#else
rdamage = max(rdamage,1);
rdamage = i64max(rdamage,1);
#endif
}

Expand Down
2 changes: 1 addition & 1 deletion src/map/buyingstore.c
Expand Up @@ -678,7 +678,7 @@ void do_init_buyingstore_autotrade( void ) {
Sql_GetData(mmysql_handle, 1, &data, NULL); at->account_id = atoi(data);
Sql_GetData(mmysql_handle, 2, &data, NULL); at->char_id = atoi(data);
Sql_GetData(mmysql_handle, 3, &data, NULL); at->sex = (data[0] == 'F') ? 0 : 1;
Sql_GetData(mmysql_handle, 4, &data, &len); safestrncpy(at->title, data, min(len + 1, MESSAGE_SIZE));
Sql_GetData(mmysql_handle, 4, &data, &len); safestrncpy(at->title, data, zmin(len + 1, MESSAGE_SIZE));
Sql_GetData(mmysql_handle, 5, &data, NULL); at->limit = atoi(data);
Sql_GetData(mmysql_handle, 6, &data, NULL); at->dir = atoi(data);
Sql_GetData(mmysql_handle, 7, &data, NULL); at->head_dir = atoi(data);
Expand Down

2 comments on commit 214ff17

@cydh
Copy link
Contributor

@cydh cydh commented on 214ff17 Oct 21, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what a call. xD
zmin, zmax
and then, that umin is same with u32min. so does umax is same as u32max.
and then.. the size_t, in some compiler will be casted to unsigned int. I wishu check the usages before pushing (can't review all yet, on mobile)

@lighta
Copy link
Member Author

@lighta lighta commented on 214ff17 Oct 21, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well it's an old thing on stash, sorry but ye I'll try do to a PR next time.
About your comment, well, size_t will be change for unsigned int, or unsigned long etc all time, basically what will change is either that will be an unsigned 4byte long (x86) or 8byte long (x64).
Unfortunatly I can't put all the variant in there so zmin, zmax it is.
About the umin and u32min, well it's kinda the same thing, on windows this will stay equal to u32, but not an all arch, that why I have both, look a table reference here : http://www.viva64.com/media/images/content/a/64-bit-migration-7-steps/image2.png
Now would it be best to force size all time or use the given int idk. Default int well the compiler will handle faster, forced our program get better handled.

Please sign in to comment.