Skip to content
This repository has been archived by the owner on Jan 8, 2025. It is now read-only.

dev: implement Into<bool,u256> trait #239

Closed
enitrat opened this issue Sep 1, 2023 · 4 comments · Fixed by #240
Closed

dev: implement Into<bool,u256> trait #239

enitrat opened this issue Sep 1, 2023 · 4 comments · Fixed by #240
Assignees
Labels
enhancement New feature or request

Comments

@enitrat
Copy link
Contributor

enitrat commented Sep 1, 2023

which allows us to naturally do

let result:u256 = a.slt(b).into();

instead of

let result = if (a.slt(b)) {
            1
        } else {
            0
        };
@enitrat enitrat added the enhancement New feature or request label Sep 1, 2023
@github-project-automation github-project-automation bot moved this to 🆕 Backlog in Kakarot on Starknet Sep 1, 2023
@khaeljy
Copy link
Contributor

khaeljy commented Sep 1, 2023

@enitrat Can I do it?

@enitrat
Copy link
Contributor Author

enitrat commented Sep 1, 2023

yes, please implement it under utils::traits

@khaeljy
Copy link
Contributor

khaeljy commented Sep 1, 2023

Perhaps we should implement Into<bool, u8> instead, which would allow conversion to any integer size?

BoolIntoU8::into(boolean_value).into()

@enitrat
Copy link
Contributor Author

enitrat commented Sep 1, 2023

I said Into<bool,u32> so that we could directly push the values to the stack, but I meant Into<bool,u256>. of course we could do all integer types but we don't need it right now

we can already convert to felt but the shorter the better ;)

@enitrat enitrat changed the title dev: implement Into<bool,u32> trait dev: implement Into<bool,u256> trait Sep 1, 2023
@github-project-automation github-project-automation bot moved this from 🆕 Backlog to ✅ Done in Kakarot on Starknet Sep 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
No open projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants