mirror of
https://github.com/urbit/ares.git
synced 2024-11-27 05:06:32 +03:00
Fix merge conflicts
This commit is contained in:
parent
eb9b5b5e16
commit
086822f22c
@ -93,13 +93,13 @@ pub fn get_jet(jet_name: Noun) -> Option<Jet> {
|
||||
//
|
||||
tas!(b"mug") => Some(jet_mug),
|
||||
//
|
||||
tas!(b"scow") => Some(jet_scow),
|
||||
//
|
||||
tas!(b"mink") => Some(jet_mink),
|
||||
//
|
||||
tas!(b"dor") => Some(jet_dor),
|
||||
tas!(b"gor") => Some(jet_gor),
|
||||
tas!(b"mor") => Some(jet_mor),
|
||||
//
|
||||
tas!(b"scow") => Some(jet_scow),
|
||||
//
|
||||
tas!(b"mink") => Some(jet_mink),
|
||||
_ => {
|
||||
// eprintln!("Unknown jet: {:?}", jet_name);
|
||||
None
|
||||
|
@ -45,6 +45,10 @@ const HOT_STATE: &[(&[Either<u64, (u64, u64)>], u64, Jet)] = &[
|
||||
//
|
||||
(&[A_50, Left(tas!(b"mug"))], 1, jet_mug),
|
||||
//
|
||||
(&[A_50, Left(tas!(b"dor"))], 1, jet_dor),
|
||||
(&[A_50, Left(tas!(b"gor"))], 1, jet_gor),
|
||||
(&[A_50, Left(tas!(b"mor"))], 1, jet_mor),
|
||||
//
|
||||
(&[A_50, Left(tas!(b"scow"))], 1, jet_scow),
|
||||
//
|
||||
(&[A_50, Left(tas!(b"mink"))], 1, jet_mink),
|
||||
|
@ -190,11 +190,7 @@ pub fn jet_lte(context: &mut Context, subject: Noun) -> Result {
|
||||
})
|
||||
}
|
||||
|
||||
pub fn jet_lth(
|
||||
_stack: &mut NockStack,
|
||||
_newt: &mut Option<&mut Newt>,
|
||||
subject: Noun,
|
||||
) -> jets::Result {
|
||||
pub fn jet_lth(_context: &mut Context, subject: Noun) -> Result {
|
||||
let arg = slot(subject, 6)?;
|
||||
let a = slot(arg, 2)?.as_atom()?;
|
||||
let b = slot(arg, 3)?.as_atom()?;
|
||||
@ -256,7 +252,7 @@ pub fn jet_sub(context: &mut Context, subject: Noun) -> Result {
|
||||
|
||||
pub mod util {
|
||||
use crate::jets::util::test::init_stack;
|
||||
use crate::noun::{Atom, Noun, YES, NO};
|
||||
use crate::noun::{Atom, Noun, NO, YES};
|
||||
|
||||
pub fn lth(a: Atom, b: Atom) -> Noun {
|
||||
let s = &mut init_stack();
|
||||
|
@ -1,19 +1,17 @@
|
||||
/** Sorting jets
|
||||
*/
|
||||
use crate::interpreter::Context;
|
||||
use crate::jets;
|
||||
use crate::jets::util::slot;
|
||||
use crate::mem::NockStack;
|
||||
use crate::mug::mug;
|
||||
use crate::newt::Newt;
|
||||
use crate::noun::{Noun, NO, YES};
|
||||
use std::cmp::Ordering;
|
||||
|
||||
crate::gdb!();
|
||||
|
||||
pub fn jet_mor(
|
||||
stack: &mut NockStack,
|
||||
_newt: &mut Option<&mut Newt>,
|
||||
subject: Noun,
|
||||
) -> jets::Result {
|
||||
pub fn jet_mor(context: &mut Context, subject: Noun) -> jets::Result {
|
||||
let stack = &mut context.stack;
|
||||
|
||||
let sam = slot(subject, 6)?;
|
||||
let a = slot(sam, 2)?;
|
||||
let b = slot(sam, 3)?;
|
||||
@ -24,22 +22,16 @@ pub fn jet_mor(
|
||||
let e = mug(stack, c.as_noun());
|
||||
let f = mug(stack, d.as_noun());
|
||||
|
||||
if e.data() == f.data() {
|
||||
Ok(util::dor(a, b))
|
||||
} else {
|
||||
if e.data() < f.data() {
|
||||
Ok(YES)
|
||||
} else {
|
||||
Ok(NO)
|
||||
}
|
||||
match e.data().cmp(&f.data()) {
|
||||
Ordering::Greater => Ok(NO),
|
||||
Ordering::Less => Ok(YES),
|
||||
Ordering::Equal => Ok(util::dor(a, b)),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn jet_gor(
|
||||
stack: &mut NockStack,
|
||||
_newt: &mut Option<&mut Newt>,
|
||||
subject: Noun,
|
||||
) -> jets::Result {
|
||||
pub fn jet_gor(context: &mut Context, subject: Noun) -> jets::Result {
|
||||
let stack = &mut context.stack;
|
||||
|
||||
let sam = slot(subject, 6)?;
|
||||
let a = slot(sam, 2)?;
|
||||
let b = slot(sam, 3)?;
|
||||
@ -47,22 +39,14 @@ pub fn jet_gor(
|
||||
let c = mug(stack, a);
|
||||
let d = mug(stack, b);
|
||||
|
||||
if c.data() == d.data() {
|
||||
Ok(util::dor(a, b))
|
||||
} else {
|
||||
if c.data() < d.data() {
|
||||
Ok(YES)
|
||||
} else {
|
||||
Ok(NO)
|
||||
}
|
||||
match c.data().cmp(&d.data()) {
|
||||
Ordering::Greater => Ok(NO),
|
||||
Ordering::Less => Ok(YES),
|
||||
Ordering::Equal => Ok(util::dor(a, b)),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn jet_dor(
|
||||
_stack: &mut NockStack,
|
||||
_newt: &mut Option<&mut Newt>,
|
||||
subject: Noun,
|
||||
) -> jets::Result {
|
||||
pub fn jet_dor(_context: &mut Context, subject: Noun) -> jets::Result {
|
||||
let sam = slot(subject, 6)?;
|
||||
let a = slot(sam, 2)?;
|
||||
let b = slot(sam, 3)?;
|
||||
@ -71,10 +55,10 @@ pub fn jet_dor(
|
||||
}
|
||||
|
||||
pub mod util {
|
||||
use either::{Left, Right};
|
||||
use crate::jets::util::slot;
|
||||
use crate::jets::math::util::lth;
|
||||
use crate::noun::{Noun, YES, NO};
|
||||
use crate::jets::util::slot;
|
||||
use crate::noun::{Noun, NO, YES};
|
||||
use either::{Left, Right};
|
||||
|
||||
pub fn dor(a: Noun, b: Noun) -> Noun {
|
||||
if unsafe { a.raw_equals(b) } {
|
||||
@ -106,9 +90,9 @@ pub mod util {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use ibig::ubig;
|
||||
use crate::jets::util::test::{A, assert_jet, init_stack};
|
||||
use crate::jets::util::test::{assert_jet, init_stack, A};
|
||||
use crate::noun::{D, T};
|
||||
use ibig::ubig;
|
||||
|
||||
#[test]
|
||||
fn test_dor() {
|
||||
|
@ -3,9 +3,6 @@
|
||||
use crate::interpreter::Context;
|
||||
use crate::jets::util::slot;
|
||||
use crate::jets::Result;
|
||||
use crate::jets::util::slot;
|
||||
use crate::mem::NockStack;
|
||||
use crate::newt::Newt;
|
||||
use crate::noun::{Noun, D};
|
||||
|
||||
crate::gdb!();
|
||||
|
Loading…
Reference in New Issue
Block a user