Skip to content

Commit

Permalink
Merge branch 'main' of github.com:higherorderco/hvm
Browse files Browse the repository at this point in the history
  • Loading branch information
VictorTaelin committed May 20, 2024
2 parents 5b3eb5d + fa81182 commit b86616f
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 133 deletions.
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ build = "build.rs"
description = "A massively parallel, optimal functional runtime in Rust."
license = "Apache-2.0"

[lib]
name = "hvm"
path = "src/lib.rs"

[dependencies]
TSPL = "0.0.12"
clap = "4.5.2"
Expand Down
125 changes: 0 additions & 125 deletions POST.md

This file was deleted.

4 changes: 2 additions & 2 deletions src/hvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,11 +390,11 @@ static inline u32 get_u24(Numb word) {

// Constructor and getters for I24 (signed 24-bit integer)
static inline Numb new_i24(i32 val) {
return (((u32)val << 4) & 0xFFFFFF) | I24;
return (((u32)val & 0xFFFFFF) << 4) | I24;
}

static inline i32 get_i24(Numb word) {
return (((word >> 4) & 0xFFFFFF) << 8) >> 8;
return ((i32)((word >> 4) & 0xFFFFFF)) << 8 >> 8;
}

// Constructor and getters for F24 (24-bit float)
Expand Down
4 changes: 2 additions & 2 deletions src/hvm.cu
Original file line number Diff line number Diff line change
Expand Up @@ -694,11 +694,11 @@ __device__ __host__ inline u32 get_u24(Numb word) {

// Constructor and getters for I24 (signed 24-bit integer)
__device__ __host__ inline Numb new_i24(i32 val) {
return (((u32)val << 4) & 0xFFFFFF) | I24;
return (((u32)val & 0xFFFFFF) << 4) | I24;
}

__device__ __host__ inline i32 get_i24(Numb word) {
return (((word >> 4) & 0xFFFFFF) << 8) >> 8;
return ((i32)((word >> 4) & 0xFFFFFF)) << 8 >> 8;
}

// Constructor and getters for F24 (24-bit float)
Expand Down
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub mod ast;
pub mod cmp;
pub mod hvm;
5 changes: 1 addition & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@
#![allow(unused_variables)]

use clap::{Arg, ArgAction, Command};
use ::hvm::{ast, cmp, hvm};
use std::fs;
use std::io::Write;
use std::path::PathBuf;
use std::process::Command as SysCommand;

mod ast;
mod cmp;
mod hvm;

#[cfg(feature = "c")]
extern "C" {
fn hvm_c(book_buffer: *const u32, run_io: bool);
Expand Down

0 comments on commit b86616f

Please sign in to comment.