News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Size of records

Started by Biterider, October 30, 2021, 06:20:54 AM

Previous topic - Next topic

Biterider

Hi
I am wondering about strange behavior when getting the size of records (bit fields).
The following code
TEST_BITS_001 record BITS_001:001
TEST_BITS_008 record BITS_008:008
TEST_BITS_016 record BITS_016:016
TEST_BITS_032 record BITS_032:032
TEST_BITS_064 record BITS_064:064
TEST_BITS_128 record BITS_128:128

%echo $ToStr(%sizeof(TEST_BITS_001))
%echo $ToStr(%sizeof(TEST_BITS_008))
%echo $ToStr(%sizeof(TEST_BITS_016))
%echo $ToStr(%sizeof(TEST_BITS_032))
%echo $ToStr(%sizeof(TEST_BITS_064))
%echo $ToStr(%sizeof(TEST_BITS_128))


returns
1
1
2
4
8
128


All of these values seem to be coherent except for the last one, which should be 128/8 = 16.

UASM Version 2.52, 32 bit

Biterider

HSE

Hi Biterider!!

Yes, is wrong   :thumbsup:

Code ( types.c ) Select
    /* now calc size in bytes and set the bit positions */

    if ( cntBits > 16 ) {
        if ( cntBits > 64 ) {
            newr->sym.total_size = 128 ;   <<<<<< must say 16
            newr->sym.mem_type = MT_OWORD;
        } else

        if ( cntBits > 32 ) {
            newr->sym.total_size = sizeof( uint_64 );
            newr->sym.mem_type = MT_QWORD;
        } else {
            newr->sym.total_size = sizeof( uint_32 );
            newr->sym.mem_type = MT_DWORD;
        }
    } else if ( cntBits > 8 ) {
        newr->sym.total_size = sizeof( uint_16 );
        newr->sym.mem_type = MT_WORD;
    } else {
        newr->sym.total_size = sizeof( uint_8 );
        newr->sym.mem_type = MT_BYTE;
    }


Regards, HSE.
Equations in Assembly: SmplMath

Biterider

Hi HSE
I didn't know you were familiar with the UASM source code.  :thumbsup:
I hope John continues to support UASM.

Biterider

HSE

#3
Hi Biterider!

Quote from: Biterider on October 30, 2021, 05:00:17 PM
I didn't know you were familiar with the UASM source code.  :thumbsup:
:biggrin: Not really, just a reminder of building assemblers that work with long source code lines.

Quote from: Biterider on October 30, 2021, 05:00:17 PM
I hope John continues to support UASM.
UASM developers can't say they don't have time to find the error  :biggrin:

Regards, HSE.
Equations in Assembly: SmplMath

Biterider

Hi HSE
I think it might be interesting to know whether the parallel developments (e.g. asmc) that have a common code base are also affected.

Biterider


HSE

Hi Biterider!

AsmC I'm using say: 1  1  2  4  1  1  😀

Regards, HSE
Equations in Assembly: SmplMath

Biterider

Hi HSE
Thanks for testing. It seems that there is a similar bug in asmc as well.  :rolleyes:
Nidud might be interested in correcting it too.

Biterider

nidud

#7
deleted

Biterider

Hi nidud
Thanks for the clarification.
Although your list of results appears to be missing a "2", the case is clear.

Biterider

johnsa

Hi,

I've added this fix into the v2.53 branch.
I've been away from UASM for some time, but I do check in here frequently to make sure nothing catastrophic has occurred :)

There are a few other open issues on GitHub for 2.53 I'd like to fix and I'll compile binaries.

Biterider

Thank you John!  :thumbsup:
Biterider