mirror of
https://github.com/urbit/ares.git
synced 2024-11-26 09:57:56 +03:00
[jets] add gth jet
This commit is contained in:
parent
bbae5bb146
commit
9fb605769e
@ -36,6 +36,7 @@ pub fn get_jet(jet_name: Noun) -> Result<Jet, ()> {
|
||||
tas!(b"mod") => Ok(jet_mod),
|
||||
tas!(b"lth") => Ok(jet_lth),
|
||||
tas!(b"lte") => Ok(jet_lte),
|
||||
tas!(b"gth") => Ok(jet_gth),
|
||||
tas!(b"cut") => Ok(jet_cut),
|
||||
tas!(b"mug") => Ok(jet_mug),
|
||||
_ => {
|
||||
|
@ -248,3 +248,29 @@ pub fn jet_lte(_stack: &mut NockStack, subject: Noun) -> Result<Noun, JetErr> {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
pub fn jet_gth(_stack: &mut NockStack, subject: Noun) -> Result<Noun, JetErr> {
|
||||
let arg = raw_slot(subject, 6);
|
||||
let a = raw_slot(arg, 2).as_atom()?;
|
||||
let b = raw_slot(arg, 3).as_atom()?;
|
||||
|
||||
Ok(if let (Ok(a), Ok(b)) = (a.as_direct(), b.as_direct()) {
|
||||
if a.data() > b.data() {
|
||||
YES
|
||||
} else {
|
||||
NO
|
||||
}
|
||||
} else {
|
||||
if a.bit_size() > b.bit_size() {
|
||||
YES
|
||||
} else if a.bit_size() < b.bit_size() {
|
||||
NO
|
||||
} else {
|
||||
if a.as_ubig() > b.as_ubig() {
|
||||
YES
|
||||
} else {
|
||||
NO
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user