2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-16 01:12:13 +00:00

64/32 bit compile working by using int32 types as needed.

This commit is contained in:
René Ferdinand Rivera Morell
2020-09-09 09:46:08 -05:00
parent 210cef7ae2
commit 84666e77fa
40 changed files with 590 additions and 603 deletions

View File

@@ -55,15 +55,15 @@ struct hash_item
typedef struct string_set
{
unsigned int num;
unsigned int size;
int32_t num;
int32_t size;
struct hash_item * * data;
} string_set;
static string_set strhash;
static int strtotal = 0;
static int strcount_in = 0;
static int strcount_out = 0;
static int32_t strtotal = 0;
static int32_t strcount_in = 0;
static int32_t strcount_out = 0;
/*
@@ -89,13 +89,13 @@ static char * storage_finish = 0;
* allocate() - Allocate n bytes of immortal string storage.
*/
static char * allocate( size_t n )
static char * allocate( int32_t n )
{
#ifdef BJAM_NEWSTR_NO_ALLOCATE
return (char *)BJAM_MALLOC( n );
#else
/* See if we can grab storage from an existing block. */
size_t remaining = storage_finish - storage_start;
int32_t remaining = int32_t(storage_finish - storage_start);
n = ( ( n + ALLOC_ALIGNMENT - 1 ) / ALLOC_ALIGNMENT ) * ALLOC_ALIGNMENT;
if ( remaining >= n )
{
@@ -106,13 +106,13 @@ static char * allocate( size_t n )
else /* Must allocate a new block. */
{
strblock * new_block;
size_t nalloc = n;
int32_t nalloc = n;
if ( nalloc < STRING_BLOCK )
nalloc = STRING_BLOCK;
/* Allocate a new block and link into the chain. */
new_block = (strblock *)BJAM_MALLOC( offsetof( strblock, data[ 0 ] ) +
nalloc * sizeof( new_block->data[ 0 ] ) );
size_t(nalloc) * sizeof( new_block->data[ 0 ] ) );
if ( new_block == 0 )
return 0;
new_block->next = strblock_chain;
@@ -130,7 +130,7 @@ static char * allocate( size_t n )
}
static unsigned int hash_keyval( char const * key, int const size )
static unsigned int hash_keyval( char const * key, int32_t size )
{
unsigned int const magic = 2147059363;
unsigned int hash = 0;
@@ -171,14 +171,13 @@ static void string_set_done( string_set * set )
static void string_set_resize( string_set * set )
{
unsigned i;
string_set new_set;
new_set.num = set->num * 2;
new_set.size = set->size;
new_set.data = (struct hash_item * *)BJAM_MALLOC( sizeof( struct hash_item *
) * new_set.num );
memset( new_set.data, 0, sizeof( struct hash_item * ) * new_set.num );
for ( i = 0; i < set->num; ++i )
for ( int32_t i = 0; i < set->num; ++i )
{
while ( set->data[ i ] )
{
@@ -195,7 +194,7 @@ static void string_set_resize( string_set * set )
static char const * string_set_insert( string_set * set, char const * string,
int const size )
int32_t const size )
{
unsigned hash = hash_keyval( string, size );
unsigned pos = hash % set->num;
@@ -248,7 +247,7 @@ static void object_validate( OBJECT * obj )
* object_new_range() - create an object from a string of given length
*/
OBJECT * object_new_range( char const * const string, size_t size )
OBJECT * object_new_range( char const * const string, int32_t size )
{
++strcount_in;
@@ -278,7 +277,7 @@ OBJECT * object_new_range( char const * const string, size_t size )
OBJECT * object_new( char const * const string )
{
return object_new_range( string, strlen( string ) );
return object_new_range( string, int32_t(strlen( string )) );
}