Ajjwidjdneidjenw Posted December 4, 2013 Group: Members Topic Count: 15 Topics Per Day: 0.00 Content Count: 161 Reputation: 31 Joined: 12/06/11 Last Seen: December 25, 2022 Share Posted December 4, 2013 (edited) Hello!I was looking through the src and stumbled upon this: #ifndef RENEWAL if( sc->data[SC_ASSUMPTIO] ) { if( map_flag_vs(bl->m) ) damage = (int64)damage*2/3; //Receive 66% damage else damage >>= 1; //Receive 50% damage } #endif So why not divide the damage by 3, then multiply it by 2? this way a 64 bit int woulnd't be required. #ifndef RENEWAL if( sc->data[SC_ASSUMPTIO] ) { if( map_flag_vs(bl->m) ) damage = damage/3*2; //Receive 66% damage else damage >>= 1; //Receive 50% damage } #endif Edited December 4, 2013 by Jeroen Quote Link to comment Share on other sites More sharing options...
Jonne Posted December 4, 2013 Group: Members Topic Count: 8 Topics Per Day: 0.00 Content Count: 153 Reputation: 33 Joined: 12/24/11 Last Seen: September 30, 2024 Share Posted December 4, 2013 (edited) Hello! I was looking through the src and stumbled upon this: #ifndef RENEWAL if( sc->data[SC_ASSUMPTIO] ) { if( map_flag_vs(bl->m) ) damage = (int64)damage*2/3; //Receive 66% damage else damage >>= 1; //Receive 50% damage } #endif So why not divide the damage by 3, then multiply it by 2? this way a 64 bit int woulnd't be required. #ifndef RENEWAL if( sc->data[SC_ASSUMPTIO] ) { if( map_flag_vs(bl->m) ) damage = damage/3*2; //Receive 66% damage else damage >>= 1; //Receive 50% damage } #endif Dividing by 3 would make it a double which is 8 Byte = 64Bit. Same size. Edited December 4, 2013 by Jonne Quote Link to comment Share on other sites More sharing options...
Variant Posted December 7, 2013 Group: Members Topic Count: 3 Topics Per Day: 0.00 Content Count: 52 Reputation: 6 Joined: 01/06/12 Last Seen: December 12, 2017 Share Posted December 7, 2013 Dividing by 3 would make it a double which is 8 Byte = 64Bit. Same size. Er, it's integer division, so it wouldn't be made into a double precision floating point number. It will still be 64 bits because damage itself is declared as an int64 though, so it's kinda moot. Why is that cast even there? Quote Link to comment Share on other sites More sharing options...
Jonne Posted December 7, 2013 Group: Members Topic Count: 8 Topics Per Day: 0.00 Content Count: 153 Reputation: 33 Joined: 12/24/11 Last Seen: September 30, 2024 Share Posted December 7, 2013 Dividing by 3 would make it a double which is 8 Byte = 64Bit. Same size. Er, it's integer division, so it wouldn't be made into a double precision floating point number. It will still be 64 bits because damage itself is declared as an int64 though, so it's kinda moot. Why is that cast even there? Oh yea, that might be. Maybe it gave warnings on some compiler systems? Dunno Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.