Skip to content

Commit 9e244d7

Browse files
committed
auto merge of #14372 : neeee/rust/intrinsic-docs, r=brson
2 parents 33c3edd + 3d63370 commit 9e244d7

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed

src/libcore/intrinsics.rs

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,110 +360,189 @@ extern "rust-intrinsic" {
360360
/// Perform a volatile store to the `dst` pointer.
361361
pub fn volatile_store<T>(dst: *mut T, val: T);
362362

363+
/// Returns the square root of an `f32`
363364
pub fn sqrtf32(x: f32) -> f32;
365+
/// Returns the square root of an `f64`
364366
pub fn sqrtf64(x: f64) -> f64;
365367

368+
/// Raises an `f32` to an integer power.
366369
pub fn powif32(a: f32, x: i32) -> f32;
370+
/// Raises an `f64` to an integer power.
367371
pub fn powif64(a: f64, x: i32) -> f64;
368372

373+
/// Returns the sine of an `f32`.
369374
pub fn sinf32(x: f32) -> f32;
375+
/// Returns the sine of an `f64`.
370376
pub fn sinf64(x: f64) -> f64;
371377

378+
/// Returns the cosine of an `f32`.
372379
pub fn cosf32(x: f32) -> f32;
380+
/// Returns the cosine of an `f64`.
373381
pub fn cosf64(x: f64) -> f64;
374382

383+
/// Raises an `f32` to an `f32` power.
375384
pub fn powf32(a: f32, x: f32) -> f32;
385+
/// Raises an `f64` to an `f64` power.
376386
pub fn powf64(a: f64, x: f64) -> f64;
377387

388+
/// Returns the exponential of an `f32`.
378389
pub fn expf32(x: f32) -> f32;
390+
/// Returns the exponential of an `f64`.
379391
pub fn expf64(x: f64) -> f64;
380392

393+
/// Returns 2 raised to the power of an `f32`.
381394
pub fn exp2f32(x: f32) -> f32;
395+
/// Returns 2 raised to the power of an `f64`.
382396
pub fn exp2f64(x: f64) -> f64;
383397

398+
/// Returns the natural logarithm of an `f32`.
384399
pub fn logf32(x: f32) -> f32;
400+
/// Returns the natural logarithm of an `f64`.
385401
pub fn logf64(x: f64) -> f64;
386402

403+
/// Returns the base 10 logarithm of an `f32`.
387404
pub fn log10f32(x: f32) -> f32;
405+
/// Returns the base 10 logarithm of an `f64`.
388406
pub fn log10f64(x: f64) -> f64;
389407

408+
/// Returns the base 2 logarithm of an `f32`.
390409
pub fn log2f32(x: f32) -> f32;
410+
/// Returns the base 2 logarithm of an `f64`.
391411
pub fn log2f64(x: f64) -> f64;
392412

413+
/// Returns `a * b + c` for `f32` values.
393414
pub fn fmaf32(a: f32, b: f32, c: f32) -> f32;
415+
/// Returns `a * b + c` for `f64` values.
394416
pub fn fmaf64(a: f64, b: f64, c: f64) -> f64;
395417

418+
/// Returns the absolute value of an `f32`.
396419
pub fn fabsf32(x: f32) -> f32;
420+
/// Returns the absolute value of an `f64`.
397421
pub fn fabsf64(x: f64) -> f64;
398422

423+
/// Copies the sign from `y` to `x` for `f32` values.
399424
pub fn copysignf32(x: f32, y: f32) -> f32;
425+
/// Copies the sign from `y` to `x` for `f64` values.
400426
pub fn copysignf64(x: f64, y: f64) -> f64;
401427

428+
/// Returns the largest integer less than or equal to an `f32`.
402429
pub fn floorf32(x: f32) -> f32;
430+
/// Returns the largest integer less than or equal to an `f64`.
403431
pub fn floorf64(x: f64) -> f64;
404432

433+
/// Returns the smallest integer greater than or equal to an `f32`.
405434
pub fn ceilf32(x: f32) -> f32;
435+
/// Returns the smallest integer greater than or equal to an `f64`.
406436
pub fn ceilf64(x: f64) -> f64;
407437

438+
/// Returns the integer part of an `f32`.
408439
pub fn truncf32(x: f32) -> f32;
440+
/// Returns the integer part of an `f64`.
409441
pub fn truncf64(x: f64) -> f64;
410442

443+
/// Returns the nearest integer to an `f32`. May raise an inexact floating-point exception
444+
/// if the argument is not an integer.
411445
pub fn rintf32(x: f32) -> f32;
446+
/// Returns the nearest integer to an `f64`. May raise an inexact floating-point exception
447+
/// if the argument is not an integer.
412448
pub fn rintf64(x: f64) -> f64;
413449

450+
/// Returns the nearest integer to an `f32`.
414451
pub fn nearbyintf32(x: f32) -> f32;
452+
/// Returns the nearest integer to an `f64`.
415453
pub fn nearbyintf64(x: f64) -> f64;
416454

455+
/// Returns the nearest integer to an `f32`. Rounds half-way cases away from zero.
417456
pub fn roundf32(x: f32) -> f32;
457+
/// Returns the nearest integer to an `f64`. Rounds half-way cases away from zero.
418458
pub fn roundf64(x: f64) -> f64;
419459

460+
/// Returns the number of bits set in a `u8`.
420461
pub fn ctpop8(x: u8) -> u8;
462+
/// Returns the number of bits set in a `u16`.
421463
pub fn ctpop16(x: u16) -> u16;
464+
/// Returns the number of bits set in a `u32`.
422465
pub fn ctpop32(x: u32) -> u32;
466+
/// Returns the number of bits set in a `u64`.
423467
pub fn ctpop64(x: u64) -> u64;
424468

469+
/// Returns the number of leading bits unset in a `u8`.
425470
pub fn ctlz8(x: u8) -> u8;
471+
/// Returns the number of leading bits unset in a `u16`.
426472
pub fn ctlz16(x: u16) -> u16;
473+
/// Returns the number of leading bits unset in a `u32`.
427474
pub fn ctlz32(x: u32) -> u32;
475+
/// Returns the number of leading bits unset in a `u64`.
428476
pub fn ctlz64(x: u64) -> u64;
429477

478+
/// Returns the number of trailing bits unset in a `u8`.
430479
pub fn cttz8(x: u8) -> u8;
480+
/// Returns the number of trailing bits unset in a `u16`.
431481
pub fn cttz16(x: u16) -> u16;
482+
/// Returns the number of trailing bits unset in a `u32`.
432483
pub fn cttz32(x: u32) -> u32;
484+
/// Returns the number of trailing bits unset in a `u64`.
433485
pub fn cttz64(x: u64) -> u64;
434486

487+
/// Reverses the bytes in a `u16`.
435488
pub fn bswap16(x: u16) -> u16;
489+
/// Reverses the bytes in a `u32`.
436490
pub fn bswap32(x: u32) -> u32;
491+
/// Reverses the bytes in a `u64`.
437492
pub fn bswap64(x: u64) -> u64;
438493

494+
/// Performs checked `i8` addition.
439495
pub fn i8_add_with_overflow(x: i8, y: i8) -> (i8, bool);
496+
/// Performs checked `i16` addition.
440497
pub fn i16_add_with_overflow(x: i16, y: i16) -> (i16, bool);
498+
/// Performs checked `i32` addition.
441499
pub fn i32_add_with_overflow(x: i32, y: i32) -> (i32, bool);
500+
/// Performs checked `i64` addition.
442501
pub fn i64_add_with_overflow(x: i64, y: i64) -> (i64, bool);
443502

503+
/// Performs checked `u8` addition.
444504
pub fn u8_add_with_overflow(x: u8, y: u8) -> (u8, bool);
505+
/// Performs checked `u16` addition.
445506
pub fn u16_add_with_overflow(x: u16, y: u16) -> (u16, bool);
507+
/// Performs checked `u32` addition.
446508
pub fn u32_add_with_overflow(x: u32, y: u32) -> (u32, bool);
509+
/// Performs checked `u64` addition.
447510
pub fn u64_add_with_overflow(x: u64, y: u64) -> (u64, bool);
448511

512+
/// Performs checked `i8` subtraction.
449513
pub fn i8_sub_with_overflow(x: i8, y: i8) -> (i8, bool);
514+
/// Performs checked `i16` subtraction.
450515
pub fn i16_sub_with_overflow(x: i16, y: i16) -> (i16, bool);
516+
/// Performs checked `i32` subtraction.
451517
pub fn i32_sub_with_overflow(x: i32, y: i32) -> (i32, bool);
518+
/// Performs checked `i64` subtraction.
452519
pub fn i64_sub_with_overflow(x: i64, y: i64) -> (i64, bool);
453520

521+
/// Performs checked `u8` subtraction.
454522
pub fn u8_sub_with_overflow(x: u8, y: u8) -> (u8, bool);
523+
/// Performs checked `u16` subtraction.
455524
pub fn u16_sub_with_overflow(x: u16, y: u16) -> (u16, bool);
525+
/// Performs checked `u32` subtraction.
456526
pub fn u32_sub_with_overflow(x: u32, y: u32) -> (u32, bool);
527+
/// Performs checked `u64` subtraction.
457528
pub fn u64_sub_with_overflow(x: u64, y: u64) -> (u64, bool);
458529

530+
/// Performs checked `i8` multiplication.
459531
pub fn i8_mul_with_overflow(x: i8, y: i8) -> (i8, bool);
532+
/// Performs checked `i16` multiplication.
460533
pub fn i16_mul_with_overflow(x: i16, y: i16) -> (i16, bool);
534+
/// Performs checked `i32` multiplication.
461535
pub fn i32_mul_with_overflow(x: i32, y: i32) -> (i32, bool);
536+
/// Performs checked `i64` multiplication.
462537
pub fn i64_mul_with_overflow(x: i64, y: i64) -> (i64, bool);
463538

539+
/// Performs checked `u8` multiplication.
464540
pub fn u8_mul_with_overflow(x: u8, y: u8) -> (u8, bool);
541+
/// Performs checked `u16` multiplication.
465542
pub fn u16_mul_with_overflow(x: u16, y: u16) -> (u16, bool);
543+
/// Performs checked `u32` multiplication.
466544
pub fn u32_mul_with_overflow(x: u32, y: u32) -> (u32, bool);
545+
/// Performs checked `u64` multiplication.
467546
pub fn u64_mul_with_overflow(x: u64, y: u64) -> (u64, bool);
468547
}
469548

0 commit comments

Comments
 (0)