Skip to content

Commit aeb8e30

Browse files
Speedy37cuviper
authored andcommitted
add inline mark to IterUXDigits
1 parent 2f9dc12 commit aeb8e30

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/biguint.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2303,6 +2303,7 @@ pub struct IterU32Digits<'a> {
23032303
}
23042304
#[cfg(u64_digit)]
23052305
impl<'a> IterU32Digits<'a> {
2306+
#[inline]
23062307
fn new(data: &'a [u64]) -> Self {
23072308
let last_hi_is_zero = data
23082309
.last()
@@ -2321,6 +2322,7 @@ impl<'a> IterU32Digits<'a> {
23212322
#[cfg(u64_digit)]
23222323
impl Iterator for IterU32Digits<'_> {
23232324
type Item = u32;
2325+
#[inline]
23242326
fn next(&mut self) -> Option<u32> {
23252327
match self.data.split_first() {
23262328
Some((&first, data)) => {
@@ -2342,11 +2344,13 @@ impl Iterator for IterU32Digits<'_> {
23422344
}
23432345
}
23442346

2347+
#[inline]
23452348
fn size_hint(&self) -> (usize, Option<usize>) {
23462349
let len = self.len();
23472350
(len, Some(len))
23482351
}
23492352

2353+
#[inline]
23502354
fn last(self) -> Option<u32> {
23512355
self.data.last().map(|&last| {
23522356
if self.last_hi_is_zero {
@@ -2357,48 +2361,57 @@ impl Iterator for IterU32Digits<'_> {
23572361
})
23582362
}
23592363

2364+
#[inline]
23602365
fn count(self) -> usize {
23612366
self.len()
23622367
}
23632368
}
23642369
#[cfg(u64_digit)]
23652370
impl ExactSizeIterator for IterU32Digits<'_> {
2371+
#[inline]
23662372
fn len(&self) -> usize {
23672373
self.data.len() * 2 - usize::from(self.last_hi_is_zero) - usize::from(!self.next_is_lo)
23682374
}
23692375
}
23702376

23712377
#[cfg(not(u64_digit))]
23722378
impl<'a> IterU32Digits<'a> {
2379+
#[inline]
23732380
fn new(data: &'a [u32]) -> Self {
23742381
Self { it: data.iter() }
23752382
}
23762383
}
23772384
#[cfg(not(u64_digit))]
23782385
impl Iterator for IterU32Digits<'_> {
23792386
type Item = u32;
2387+
#[inline]
23802388
fn next(&mut self) -> Option<u32> {
23812389
self.it.next().cloned()
23822390
}
23832391

2392+
#[inline]
23842393
fn size_hint(&self) -> (usize, Option<usize>) {
23852394
self.it.size_hint()
23862395
}
23872396

2397+
#[inline]
23882398
fn nth(&mut self, n: usize) -> Option<u32> {
23892399
self.it.nth(n).cloned()
23902400
}
23912401

2402+
#[inline]
23922403
fn last(self) -> Option<u32> {
23932404
self.it.last().cloned()
23942405
}
23952406

2407+
#[inline]
23962408
fn count(self) -> usize {
23972409
self.it.count()
23982410
}
23992411
}
24002412
#[cfg(not(u64_digit))]
24012413
impl ExactSizeIterator for IterU32Digits<'_> {
2414+
#[inline]
24022415
fn len(&self) -> usize {
24032416
self.it.len()
24042417
}
@@ -2417,6 +2430,7 @@ pub struct IterU64Digits<'a> {
24172430
}
24182431
#[cfg(not(u64_digit))]
24192432
impl<'a> IterU64Digits<'a> {
2433+
#[inline]
24202434
fn new(data: &'a [u32]) -> Self {
24212435
IterU64Digits { it: data.chunks(2) }
24222436
}
@@ -2425,61 +2439,73 @@ impl<'a> IterU64Digits<'a> {
24252439
#[cfg(not(u64_digit))]
24262440
impl Iterator for IterU64Digits<'_> {
24272441
type Item = u64;
2442+
#[inline]
24282443
fn next(&mut self) -> Option<u64> {
24292444
self.it.next().map(u32_chunk_to_u64)
24302445
}
24312446

2447+
#[inline]
24322448
fn size_hint(&self) -> (usize, Option<usize>) {
24332449
let len = self.len();
24342450
(len, Some(len))
24352451
}
24362452

2453+
#[inline]
24372454
fn last(self) -> Option<u64> {
24382455
self.it.last().map(u32_chunk_to_u64)
24392456
}
24402457

2458+
#[inline]
24412459
fn count(self) -> usize {
24422460
self.len()
24432461
}
24442462
}
24452463
#[cfg(not(u64_digit))]
24462464
impl ExactSizeIterator for IterU64Digits<'_> {
2465+
#[inline]
24472466
fn len(&self) -> usize {
24482467
self.it.len()
24492468
}
24502469
}
24512470

24522471
#[cfg(u64_digit)]
24532472
impl<'a> IterU64Digits<'a> {
2473+
#[inline]
24542474
fn new(data: &'a [u64]) -> Self {
24552475
Self { it: data.iter() }
24562476
}
24572477
}
24582478
#[cfg(u64_digit)]
24592479
impl Iterator for IterU64Digits<'_> {
24602480
type Item = u64;
2481+
#[inline]
24612482
fn next(&mut self) -> Option<u64> {
24622483
self.it.next().cloned()
24632484
}
24642485

2486+
#[inline]
24652487
fn size_hint(&self) -> (usize, Option<usize>) {
24662488
self.it.size_hint()
24672489
}
24682490

2491+
#[inline]
24692492
fn nth(&mut self, n: usize) -> Option<u64> {
24702493
self.it.nth(n).cloned()
24712494
}
24722495

2496+
#[inline]
24732497
fn last(self) -> Option<u64> {
24742498
self.it.last().cloned()
24752499
}
24762500

2501+
#[inline]
24772502
fn count(self) -> usize {
24782503
self.it.count()
24792504
}
24802505
}
24812506
#[cfg(u64_digit)]
24822507
impl ExactSizeIterator for IterU64Digits<'_> {
2508+
#[inline]
24832509
fn len(&self) -> usize {
24842510
self.it.len()
24852511
}

0 commit comments

Comments
 (0)