Running latest rustfmt. No functional change.
This commit is contained in:
parent
ab637e3bd5
commit
498c1ea8d9
|
@ -11,7 +11,7 @@ use math::{Normal, Point, Vector};
|
||||||
use shading::surface_closure::SurfaceClosure;
|
use shading::surface_closure::SurfaceClosure;
|
||||||
|
|
||||||
pub use self::bvh::{BVHNode, BVH};
|
pub use self::bvh::{BVHNode, BVH};
|
||||||
pub use self::bvh4::{BVH4, BVH4Node};
|
pub use self::bvh4::{BVH4Node, BVH4};
|
||||||
pub use self::light_array::LightArray;
|
pub use self::light_array::LightArray;
|
||||||
pub use self::light_tree::LightTree;
|
pub use self::light_tree::LightTree;
|
||||||
|
|
||||||
|
|
|
@ -36,8 +36,7 @@ impl<'a> RectangleLight<'a> {
|
||||||
.map(|d| BBox {
|
.map(|d| BBox {
|
||||||
min: Point::new(d.0 * -0.5, d.1 * -0.5, 0.0),
|
min: Point::new(d.0 * -0.5, d.1 * -0.5, 0.0),
|
||||||
max: Point::new(d.0 * 0.5, d.1 * 0.5, 0.0),
|
max: Point::new(d.0 * 0.5, d.1 * 0.5, 0.0),
|
||||||
})
|
}).collect();
|
||||||
.collect();
|
|
||||||
RectangleLight {
|
RectangleLight {
|
||||||
dimensions: arena.copy_slice(&dimensions),
|
dimensions: arena.copy_slice(&dimensions),
|
||||||
colors: arena.copy_slice(&colors),
|
colors: arena.copy_slice(&colors),
|
||||||
|
|
|
@ -35,8 +35,7 @@ impl<'a> SphereLight<'a> {
|
||||||
.map(|r| BBox {
|
.map(|r| BBox {
|
||||||
min: Point::new(-*r, -*r, -*r),
|
min: Point::new(-*r, -*r, -*r),
|
||||||
max: Point::new(*r, *r, *r),
|
max: Point::new(*r, *r, *r),
|
||||||
})
|
}).collect();
|
||||||
.collect();
|
|
||||||
SphereLight {
|
SphereLight {
|
||||||
radii: arena.copy_slice(&radii),
|
radii: arena.copy_slice(&radii),
|
||||||
colors: arena.copy_slice(&colors),
|
colors: arena.copy_slice(&colors),
|
||||||
|
@ -257,8 +256,7 @@ impl<'a> Surface for SphereLight<'a> {
|
||||||
|
|
||||||
// Get our final parametric values
|
// Get our final parametric values
|
||||||
let mut t0 = q / a;
|
let mut t0 = q / a;
|
||||||
let mut t1 =
|
let mut t1 = if q != 0.0 { c / q } else { r.max_t };
|
||||||
if q != 0.0 { c / q } else { r.max_t };
|
|
||||||
|
|
||||||
// Swap them so they are ordered right
|
// Swap them so they are ordered right
|
||||||
if t0 > t1 {
|
if t0 > t1 {
|
||||||
|
|
33
src/main.rs
33
src/main.rs
|
@ -91,8 +91,7 @@ fn main() {
|
||||||
.help("Input .psy file")
|
.help("Input .psy file")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.required_unless_one(&["dev", "use_stdin"]),
|
.required_unless_one(&["dev", "use_stdin"]),
|
||||||
)
|
).arg(
|
||||||
.arg(
|
|
||||||
Arg::with_name("spp")
|
Arg::with_name("spp")
|
||||||
.short("s")
|
.short("s")
|
||||||
.long("spp")
|
.long("spp")
|
||||||
|
@ -104,8 +103,7 @@ fn main() {
|
||||||
.and(Ok(()))
|
.and(Ok(()))
|
||||||
.or(Err("must be an integer".to_string()))
|
.or(Err("must be an integer".to_string()))
|
||||||
}),
|
}),
|
||||||
)
|
).arg(
|
||||||
.arg(
|
|
||||||
Arg::with_name("max_bucket_samples")
|
Arg::with_name("max_bucket_samples")
|
||||||
.short("b")
|
.short("b")
|
||||||
.long("spb")
|
.long("spb")
|
||||||
|
@ -117,24 +115,21 @@ fn main() {
|
||||||
.and(Ok(()))
|
.and(Ok(()))
|
||||||
.or(Err("must be an integer".to_string()))
|
.or(Err("must be an integer".to_string()))
|
||||||
}),
|
}),
|
||||||
)
|
).arg(
|
||||||
.arg(
|
|
||||||
Arg::with_name("crop")
|
Arg::with_name("crop")
|
||||||
.long("crop")
|
.long("crop")
|
||||||
.value_name("X1 Y1 X2 Y2")
|
.value_name("X1 Y1 X2 Y2")
|
||||||
.help(
|
.help(
|
||||||
"Only render the image between pixel coordinates (X1, Y1) \
|
"Only render the image between pixel coordinates (X1, Y1) \
|
||||||
and (X2, Y2). Coordinates are zero-indexed and inclusive.",
|
and (X2, Y2). Coordinates are zero-indexed and inclusive.",
|
||||||
)
|
).takes_value(true)
|
||||||
.takes_value(true)
|
|
||||||
.number_of_values(4)
|
.number_of_values(4)
|
||||||
.validator(|s| {
|
.validator(|s| {
|
||||||
usize::from_str(&s)
|
usize::from_str(&s)
|
||||||
.and(Ok(()))
|
.and(Ok(()))
|
||||||
.or(Err("must be four integers".to_string()))
|
.or(Err("must be four integers".to_string()))
|
||||||
}),
|
}),
|
||||||
)
|
).arg(
|
||||||
.arg(
|
|
||||||
Arg::with_name("threads")
|
Arg::with_name("threads")
|
||||||
.short("t")
|
.short("t")
|
||||||
.long("threads")
|
.long("threads")
|
||||||
|
@ -142,37 +137,31 @@ fn main() {
|
||||||
.help(
|
.help(
|
||||||
"Number of threads to render with. Defaults to the number of logical \
|
"Number of threads to render with. Defaults to the number of logical \
|
||||||
cores on the system.",
|
cores on the system.",
|
||||||
)
|
).takes_value(true)
|
||||||
.takes_value(true)
|
|
||||||
.validator(|s| {
|
.validator(|s| {
|
||||||
usize::from_str(&s)
|
usize::from_str(&s)
|
||||||
.and(Ok(()))
|
.and(Ok(()))
|
||||||
.or(Err("must be an integer".to_string()))
|
.or(Err("must be an integer".to_string()))
|
||||||
}),
|
}),
|
||||||
)
|
).arg(
|
||||||
.arg(
|
|
||||||
Arg::with_name("stats")
|
Arg::with_name("stats")
|
||||||
.long("stats")
|
.long("stats")
|
||||||
.help("Print additional statistics about rendering"),
|
.help("Print additional statistics about rendering"),
|
||||||
)
|
).arg(
|
||||||
.arg(
|
|
||||||
Arg::with_name("dev")
|
Arg::with_name("dev")
|
||||||
.long("dev")
|
.long("dev")
|
||||||
.help("Show useful dev/debug info."),
|
.help("Show useful dev/debug info."),
|
||||||
)
|
).arg(
|
||||||
.arg(
|
|
||||||
Arg::with_name("serialized_output")
|
Arg::with_name("serialized_output")
|
||||||
.long("serialized_output")
|
.long("serialized_output")
|
||||||
.help("Serialize and send render output to standard output.")
|
.help("Serialize and send render output to standard output.")
|
||||||
.hidden(true),
|
.hidden(true),
|
||||||
)
|
).arg(
|
||||||
.arg(
|
|
||||||
Arg::with_name("use_stdin")
|
Arg::with_name("use_stdin")
|
||||||
.long("use_stdin")
|
.long("use_stdin")
|
||||||
.help("Take scene file in from stdin instead of a file path.")
|
.help("Take scene file in from stdin instead of a file path.")
|
||||||
.hidden(true),
|
.hidden(true),
|
||||||
)
|
).get_matches();
|
||||||
.get_matches();
|
|
||||||
|
|
||||||
// Print some misc useful dev info.
|
// Print some misc useful dev info.
|
||||||
if args.is_present("dev") {
|
if args.is_present("dev") {
|
||||||
|
|
|
@ -207,7 +207,8 @@ fn parse_output_info(tree: &DataTree) -> Result<String, PsyParseError> {
|
||||||
type_name,
|
type_name,
|
||||||
contents,
|
contents,
|
||||||
byte_offset,
|
byte_offset,
|
||||||
} if type_name == "Path" =>
|
}
|
||||||
|
if type_name == "Path" =>
|
||||||
{
|
{
|
||||||
// Trim and validate
|
// Trim and validate
|
||||||
let tc = contents.trim();
|
let tc = contents.trim();
|
||||||
|
@ -270,7 +271,8 @@ fn parse_render_settings(tree: &DataTree) -> Result<((u32, u32), u32, u32), PsyP
|
||||||
type_name,
|
type_name,
|
||||||
contents,
|
contents,
|
||||||
byte_offset,
|
byte_offset,
|
||||||
} if type_name == "Resolution" =>
|
}
|
||||||
|
if type_name == "Resolution" =>
|
||||||
{
|
{
|
||||||
if let IResult::Done(_, (w, h)) =
|
if let IResult::Done(_, (w, h)) =
|
||||||
closure!(terminated!(tuple!(ws_u32, ws_u32), eof!()))(contents.as_bytes())
|
closure!(terminated!(tuple!(ws_u32, ws_u32), eof!()))(contents.as_bytes())
|
||||||
|
@ -292,7 +294,8 @@ fn parse_render_settings(tree: &DataTree) -> Result<((u32, u32), u32, u32), PsyP
|
||||||
type_name,
|
type_name,
|
||||||
contents,
|
contents,
|
||||||
byte_offset,
|
byte_offset,
|
||||||
} if type_name == "SamplesPerPixel" =>
|
}
|
||||||
|
if type_name == "SamplesPerPixel" =>
|
||||||
{
|
{
|
||||||
if let IResult::Done(_, n) = ws_u32(contents.as_bytes()) {
|
if let IResult::Done(_, n) = ws_u32(contents.as_bytes()) {
|
||||||
found_spp = true;
|
found_spp = true;
|
||||||
|
@ -313,7 +316,8 @@ fn parse_render_settings(tree: &DataTree) -> Result<((u32, u32), u32, u32), PsyP
|
||||||
type_name,
|
type_name,
|
||||||
contents,
|
contents,
|
||||||
byte_offset,
|
byte_offset,
|
||||||
} if type_name == "Seed" =>
|
}
|
||||||
|
if type_name == "Seed" =>
|
||||||
{
|
{
|
||||||
if let IResult::Done(_, n) = ws_u32(contents.as_bytes()) {
|
if let IResult::Done(_, n) = ws_u32(contents.as_bytes()) {
|
||||||
seed = n;
|
seed = n;
|
||||||
|
@ -366,7 +370,8 @@ fn parse_camera<'a>(arena: &'a MemArena, tree: &'a DataTree) -> Result<Camera<'a
|
||||||
type_name,
|
type_name,
|
||||||
contents,
|
contents,
|
||||||
byte_offset,
|
byte_offset,
|
||||||
} if type_name == "Fov" =>
|
}
|
||||||
|
if type_name == "Fov" =>
|
||||||
{
|
{
|
||||||
if let IResult::Done(_, fov) = ws_f32(contents.as_bytes()) {
|
if let IResult::Done(_, fov) = ws_f32(contents.as_bytes()) {
|
||||||
fovs.push(fov * (f32::consts::PI / 180.0));
|
fovs.push(fov * (f32::consts::PI / 180.0));
|
||||||
|
@ -386,7 +391,8 @@ fn parse_camera<'a>(arena: &'a MemArena, tree: &'a DataTree) -> Result<Camera<'a
|
||||||
type_name,
|
type_name,
|
||||||
contents,
|
contents,
|
||||||
byte_offset,
|
byte_offset,
|
||||||
} if type_name == "FocalDistance" =>
|
}
|
||||||
|
if type_name == "FocalDistance" =>
|
||||||
{
|
{
|
||||||
if let IResult::Done(_, fd) = ws_f32(contents.as_bytes()) {
|
if let IResult::Done(_, fd) = ws_f32(contents.as_bytes()) {
|
||||||
focus_distances.push(fd);
|
focus_distances.push(fd);
|
||||||
|
@ -406,7 +412,8 @@ fn parse_camera<'a>(arena: &'a MemArena, tree: &'a DataTree) -> Result<Camera<'a
|
||||||
type_name,
|
type_name,
|
||||||
contents,
|
contents,
|
||||||
byte_offset,
|
byte_offset,
|
||||||
} if type_name == "ApertureRadius" =>
|
}
|
||||||
|
if type_name == "ApertureRadius" =>
|
||||||
{
|
{
|
||||||
if let IResult::Done(_, ar) = ws_f32(contents.as_bytes()) {
|
if let IResult::Done(_, ar) = ws_f32(contents.as_bytes()) {
|
||||||
aperture_radii.push(ar);
|
aperture_radii.push(ar);
|
||||||
|
@ -426,7 +433,8 @@ fn parse_camera<'a>(arena: &'a MemArena, tree: &'a DataTree) -> Result<Camera<'a
|
||||||
type_name,
|
type_name,
|
||||||
contents,
|
contents,
|
||||||
byte_offset,
|
byte_offset,
|
||||||
} if type_name == "Transform" =>
|
}
|
||||||
|
if type_name == "Transform" =>
|
||||||
{
|
{
|
||||||
if let Ok(mat) = parse_matrix(contents) {
|
if let Ok(mat) = parse_matrix(contents) {
|
||||||
mats.push(mat);
|
mats.push(mat);
|
||||||
|
|
|
@ -51,7 +51,8 @@ pub fn parse_assembly<'a>(
|
||||||
// Get surface shader binding, if any.
|
// Get surface shader binding, if any.
|
||||||
let surface_shader_name = if child
|
let surface_shader_name = if child
|
||||||
.iter_leaf_children_with_type("SurfaceShaderBind")
|
.iter_leaf_children_with_type("SurfaceShaderBind")
|
||||||
.count() > 0
|
.count()
|
||||||
|
> 0
|
||||||
{
|
{
|
||||||
Some(
|
Some(
|
||||||
child
|
child
|
||||||
|
|
|
@ -31,7 +31,8 @@ pub fn parse_distant_disk_light<'a>(
|
||||||
type_name,
|
type_name,
|
||||||
contents,
|
contents,
|
||||||
byte_offset,
|
byte_offset,
|
||||||
} if type_name == "Radius" =>
|
}
|
||||||
|
if type_name == "Radius" =>
|
||||||
{
|
{
|
||||||
if let IResult::Done(_, radius) = ws_f32(contents.as_bytes()) {
|
if let IResult::Done(_, radius) = ws_f32(contents.as_bytes()) {
|
||||||
radii.push(radius);
|
radii.push(radius);
|
||||||
|
@ -46,7 +47,8 @@ pub fn parse_distant_disk_light<'a>(
|
||||||
type_name,
|
type_name,
|
||||||
contents,
|
contents,
|
||||||
byte_offset,
|
byte_offset,
|
||||||
} if type_name == "Direction" =>
|
}
|
||||||
|
if type_name == "Direction" =>
|
||||||
{
|
{
|
||||||
if let IResult::Done(_, direction) =
|
if let IResult::Done(_, direction) =
|
||||||
closure!(tuple!(ws_f32, ws_f32, ws_f32))(contents.as_bytes())
|
closure!(tuple!(ws_f32, ws_f32, ws_f32))(contents.as_bytes())
|
||||||
|
@ -63,7 +65,8 @@ pub fn parse_distant_disk_light<'a>(
|
||||||
type_name,
|
type_name,
|
||||||
contents,
|
contents,
|
||||||
byte_offset,
|
byte_offset,
|
||||||
} if type_name == "Color" =>
|
}
|
||||||
|
if type_name == "Color" =>
|
||||||
{
|
{
|
||||||
if let IResult::Done(_, color) =
|
if let IResult::Done(_, color) =
|
||||||
closure!(tuple!(ws_f32, ws_f32, ws_f32))(contents.as_bytes())
|
closure!(tuple!(ws_f32, ws_f32, ws_f32))(contents.as_bytes())
|
||||||
|
@ -104,7 +107,8 @@ pub fn parse_sphere_light<'a>(
|
||||||
type_name,
|
type_name,
|
||||||
contents,
|
contents,
|
||||||
byte_offset,
|
byte_offset,
|
||||||
} if type_name == "Radius" =>
|
}
|
||||||
|
if type_name == "Radius" =>
|
||||||
{
|
{
|
||||||
if let IResult::Done(_, radius) = ws_f32(contents.as_bytes()) {
|
if let IResult::Done(_, radius) = ws_f32(contents.as_bytes()) {
|
||||||
radii.push(radius);
|
radii.push(radius);
|
||||||
|
@ -119,7 +123,8 @@ pub fn parse_sphere_light<'a>(
|
||||||
type_name,
|
type_name,
|
||||||
contents,
|
contents,
|
||||||
byte_offset,
|
byte_offset,
|
||||||
} if type_name == "Color" =>
|
}
|
||||||
|
if type_name == "Color" =>
|
||||||
{
|
{
|
||||||
if let IResult::Done(_, color) =
|
if let IResult::Done(_, color) =
|
||||||
closure!(tuple!(ws_f32, ws_f32, ws_f32))(contents.as_bytes())
|
closure!(tuple!(ws_f32, ws_f32, ws_f32))(contents.as_bytes())
|
||||||
|
@ -160,7 +165,8 @@ pub fn parse_rectangle_light<'a>(
|
||||||
type_name,
|
type_name,
|
||||||
contents,
|
contents,
|
||||||
byte_offset,
|
byte_offset,
|
||||||
} if type_name == "Dimensions" =>
|
}
|
||||||
|
if type_name == "Dimensions" =>
|
||||||
{
|
{
|
||||||
if let IResult::Done(_, radius) =
|
if let IResult::Done(_, radius) =
|
||||||
closure!(tuple!(ws_f32, ws_f32))(contents.as_bytes())
|
closure!(tuple!(ws_f32, ws_f32))(contents.as_bytes())
|
||||||
|
@ -177,7 +183,8 @@ pub fn parse_rectangle_light<'a>(
|
||||||
type_name,
|
type_name,
|
||||||
contents,
|
contents,
|
||||||
byte_offset,
|
byte_offset,
|
||||||
} if type_name == "Color" =>
|
}
|
||||||
|
if type_name == "Color" =>
|
||||||
{
|
{
|
||||||
if let IResult::Done(_, color) =
|
if let IResult::Done(_, color) =
|
||||||
closure!(tuple!(ws_f32, ws_f32, ws_f32))(contents.as_bytes())
|
closure!(tuple!(ws_f32, ws_f32, ws_f32))(contents.as_bytes())
|
||||||
|
|
|
@ -621,7 +621,8 @@ impl LightPath {
|
||||||
.world
|
.world
|
||||||
.background_color
|
.background_color
|
||||||
.to_spectral_sample(self.wavelength)
|
.to_spectral_sample(self.wavelength)
|
||||||
.e * self.light_attenuation
|
.e
|
||||||
|
* self.light_attenuation
|
||||||
/ self.closure_sample_pdf;
|
/ self.closure_sample_pdf;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -307,10 +307,10 @@ impl<'a> AssemblyBuilder<'a> {
|
||||||
InstanceType::Assembly => {
|
InstanceType::Assembly => {
|
||||||
self.assemblies[inst.data_index]
|
self.assemblies[inst.data_index]
|
||||||
.light_accel
|
.light_accel
|
||||||
.approximate_energy() > 0.0
|
.approximate_energy()
|
||||||
|
> 0.0
|
||||||
}
|
}
|
||||||
})
|
}).cloned()
|
||||||
.cloned()
|
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
// Build light accel
|
// Build light accel
|
||||||
|
|
|
@ -435,8 +435,9 @@ impl GTRClosure {
|
||||||
let roughness2 = self.roughness * self.roughness;
|
let roughness2 = self.roughness * self.roughness;
|
||||||
|
|
||||||
// Calculate top half of equation
|
// Calculate top half of equation
|
||||||
let top = 1.0 - ((roughness2.powf(1.0 - self.tail_shape) * (1.0 - u)) + u)
|
let top = 1.0
|
||||||
.powf(1.0 / (1.0 - self.tail_shape));
|
- ((roughness2.powf(1.0 - self.tail_shape) * (1.0 - u)) + u)
|
||||||
|
.powf(1.0 / (1.0 - self.tail_shape));
|
||||||
|
|
||||||
// Calculate bottom half of equation
|
// Calculate bottom half of equation
|
||||||
let bottom = 1.0 - roughness2;
|
let bottom = 1.0 - roughness2;
|
||||||
|
|
|
@ -139,9 +139,9 @@ pub fn surface_point(tri: (Point, Point, Point), bary: (f32, f32, f32)) -> (Poin
|
||||||
|
|
||||||
let pos_err = (((tri.0.into_vector().abs() * bary.0)
|
let pos_err = (((tri.0.into_vector().abs() * bary.0)
|
||||||
+ (tri.1.into_vector().abs() * bary.1)
|
+ (tri.1.into_vector().abs() * bary.1)
|
||||||
+ (tri.2.into_vector().abs() * bary.2)) * fp_gamma(7))
|
+ (tri.2.into_vector().abs() * bary.2))
|
||||||
.co
|
* fp_gamma(7)).co
|
||||||
.h_max();
|
.h_max();
|
||||||
|
|
||||||
(pos, pos_err)
|
(pos, pos_err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,15 +201,18 @@ fn rgb_to_xyz(chroma: Chromaticities, y: f64) -> [[f64; 3]; 3] {
|
||||||
|
|
||||||
let sr = (x * (chroma.b.1 - chroma.g.1)
|
let sr = (x * (chroma.b.1 - chroma.g.1)
|
||||||
- chroma.g.0 * (y * (chroma.b.1 - 1.0) + chroma.b.1 * (x + z))
|
- chroma.g.0 * (y * (chroma.b.1 - 1.0) + chroma.b.1 * (x + z))
|
||||||
+ chroma.b.0 * (y * (chroma.g.1 - 1.0) + chroma.g.1 * (x + z))) / d;
|
+ chroma.b.0 * (y * (chroma.g.1 - 1.0) + chroma.g.1 * (x + z)))
|
||||||
|
/ d;
|
||||||
|
|
||||||
let sg = (x * (chroma.r.1 - chroma.b.1)
|
let sg = (x * (chroma.r.1 - chroma.b.1)
|
||||||
+ chroma.r.0 * (y * (chroma.b.1 - 1.0) + chroma.b.1 * (x + z))
|
+ chroma.r.0 * (y * (chroma.b.1 - 1.0) + chroma.b.1 * (x + z))
|
||||||
- chroma.b.0 * (y * (chroma.r.1 - 1.0) + chroma.r.1 * (x + z))) / d;
|
- chroma.b.0 * (y * (chroma.r.1 - 1.0) + chroma.r.1 * (x + z)))
|
||||||
|
/ d;
|
||||||
|
|
||||||
let sb = (x * (chroma.g.1 - chroma.r.1)
|
let sb = (x * (chroma.g.1 - chroma.r.1)
|
||||||
- chroma.r.0 * (y * (chroma.g.1 - 1.0) + chroma.g.1 * (x + z))
|
- chroma.r.0 * (y * (chroma.g.1 - 1.0) + chroma.g.1 * (x + z))
|
||||||
+ chroma.g.0 * (y * (chroma.r.1 - 1.0) + chroma.r.1 * (x + z))) / d;
|
+ chroma.g.0 * (y * (chroma.r.1 - 1.0) + chroma.r.1 * (x + z)))
|
||||||
|
/ d;
|
||||||
|
|
||||||
// Assemble the matrix
|
// Assemble the matrix
|
||||||
let mut mat = [[0.0; 3]; 3];
|
let mut mat = [[0.0; 3]; 3];
|
||||||
|
|
|
@ -255,8 +255,7 @@ fn get_faure_permutation(faure: &Vec<Vec<usize>>, b: usize) -> Vec<usize> {
|
||||||
|
|
||||||
let f: usize = faure[b - 1][i - ((i > c) as usize)];
|
let f: usize = faure[b - 1][i - ((i > c) as usize)];
|
||||||
f + ((f >= c) as usize)
|
f + ((f >= c) as usize)
|
||||||
})
|
}).collect();
|
||||||
.collect();
|
|
||||||
} else {
|
} else {
|
||||||
// even
|
// even
|
||||||
let c = b / 2;
|
let c = b / 2;
|
||||||
|
@ -268,8 +267,7 @@ fn get_faure_permutation(faure: &Vec<Vec<usize>>, b: usize) -> Vec<usize> {
|
||||||
} else {
|
} else {
|
||||||
2 * faure[c][i - c] + 1
|
2 * faure[c][i - c] + 1
|
||||||
}
|
}
|
||||||
})
|
}).collect();
|
||||||
.collect();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -303,7 +303,8 @@ impl MemArena {
|
||||||
let w1 =
|
let w1 =
|
||||||
((blocks[0].capacity() - blocks[0].len()) * 100) / blocks[0].capacity();
|
((blocks[0].capacity() - blocks[0].len()) * 100) / blocks[0].capacity();
|
||||||
let w2 = ((self.stat_space_occupied.get() - self.stat_space_allocated.get())
|
let w2 = ((self.stat_space_occupied.get() - self.stat_space_allocated.get())
|
||||||
* 100) / self.stat_space_occupied.get();
|
* 100)
|
||||||
|
/ self.stat_space_occupied.get();
|
||||||
if w1 < w2 {
|
if w1 < w2 {
|
||||||
w1
|
w1
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user