Skip to content

add no_std attribute #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion extras/simple-bench/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ impl Input {
fn main() {
let opt: Opt = StructOpt::from_args();

let methods = if !opt.only_fast_float && !matches!(&opt.command, &Cmd::All {..}) {
let methods = if !opt.only_fast_float && !matches!(&opt.command, &Cmd::All { .. }) {
Method::all().into()
} else {
vec![Method::FastFloat]
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
clippy::module_name_repetitions,
clippy::cargo_common_metadata
)]
#![cfg_attr(not(feature = "std"), no_std)]

use core::fmt::{self, Display};

Expand Down
8 changes: 2 additions & 6 deletions src/number.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,11 @@ fn try_parse_8digits(s: &mut AsciiStr<'_>, x: &mut u64) {
// may cause overflows, to be handled later
if let Some(v) = s.try_read_u64() {
if is_8digits(v) {
*x = x
.wrapping_mul(1_0000_0000)
.wrapping_add(parse_8digits(v));
*x = x.wrapping_mul(1_0000_0000).wrapping_add(parse_8digits(v));
s.step_by(8);
if let Some(v) = s.try_read_u64() {
if is_8digits(v) {
*x = x
.wrapping_mul(1_0000_0000)
.wrapping_add(parse_8digits(v));
*x = x.wrapping_mul(1_0000_0000).wrapping_add(parse_8digits(v));
s.step_by(8);
}
}
Expand Down