Skip to content

Conversation

@Stevengre
Copy link
Contributor

@Stevengre Stevengre commented Nov 6, 2025

@Stevengre Stevengre self-assigned this Nov 6, 2025
@Stevengre Stevengre marked this pull request as ready for review November 6, 2025 15:26
Copy link
Member

@jberthold jberthold left a comment

Choose a reason for hiding this comment

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

Nice work! Just A few details to adjust...
We should probably add a simplification for the round-trip with symbolic values, like the one I added for amount in the p-token module.

Copy link
Collaborator

@dkcumming dkcumming left a comment

Choose a reason for hiding this comment

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

Nice work.

andBool lookupTy(TY_DEST_INNER) ==K lookupTy(TY_SRC_OUTER) // and is well-formed (invariant)
```

Casting a byte array/slice to an integer reinterprets the bytes in little-endian order.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I suspect this actually depends on architecture, and we do have access to that information in the configuration via the MachineInfo field Endian (link). Not sure if it is an easy inclusion but given we would then want to check it on different endian machines to ensure it works I think it's worth investigating right now. At least a note should be included as this should break on other architectures iiuc.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe we just add a TODO? We have a few more places where we assume little-endian byte order and machine word size 64bit.

@dkcumming
Copy link
Collaborator

I investigated this applied to p-token test_process_close_account, it is removing the thunk but there is no simplification so a large expression is what is left. I will make an issue to simplify this expression.

#cast ( Range ( ListItem (Integer ( ?AMOUNT:Int &Int 255 , 8 , false ))
          ListItem (Integer ( ?AMOUNT:Int >>Int 8 &Int 255 , 8 , false ))
          ListItem (Integer ( ?AMOUNT:Int >>Int 8 >>Int 8 &Int 255 , 8 , false ))
          ListItem (Integer ( ?AMOUNT:Int >>Int 8 >>Int 8 >>Int 8 &Int 255 , 8 , false ))
          ListItem (Integer ( ?AMOUNT:Int >>Int 8 >>Int 8 >>Int 8 >>Int 8 &Int 255 , 8 , false ))
          ListItem (Integer ( ?AMOUNT:Int >>Int 8 >>Int 8 >>Int 8 >>Int 8 >>Int 8 &Int 255 , 8 , false ))
          ListItem (Integer ( ?AMOUNT:Int >>Int 8 >>Int 8 >>Int 8 >>Int 8 >>Int 8 >>Int 8 &Int 255 , 8 , false ))
          ListItem (Integer ( ?AMOUNT:Int >>Int 8 >>Int 8 >>Int 8 >>Int 8 >>Int 8 >>Int 8 >>Int 8 &Int 255 , 8 , false ))
          ) , castKindTransmute , ty ( 600721 ) , ty ( 600142 ) )

=>

Integer ( ?AMOUNT:Int &Int 255 +Int 256 *Int ?AMOUNT:Int >>Int 8 &Int 255 +Int 256 *Int ?AMOUNT:Int >>Int 8 >>Int 8 &Int 255 +Int 256 *Int ?AMOUNT:Int >>Int 8 >>Int 8 >>Int 8 &Int 255 +Int 256 *Int ?AMOUNT:Int >>Int 8 >>Int 8 >>Int 8 >>Int 8 &Int 255 +Int 256 *Int ?AMOUNT:Int >>Int 8 >>Int 8 >>Int 8 >>Int 8 >>Int 8 &Int 255 +Int 256 *Int ?AMOUNT:Int >>Int 8 >>Int 8 >>Int 8 >>Int 8 >>Int 8 >>Int 8 &Int 255 +Int 256 *Int ?AMOUNT:Int >>Int 8 >>Int 8 >>Int 8 >>Int 8 >>Int 8 >>Int 8 >>Int 8 &Int 255 &Int 18446744073709551615 , 64 , false )

@automergerpr-permission-manager automergerpr-permission-manager bot merged commit 7b09892 into master Nov 7, 2025
7 checks passed
@automergerpr-permission-manager automergerpr-permission-manager bot deleted the jh/int-bytes-cast branch November 7, 2025 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants