Skip to content

Commit fc0f6e8

Browse files
committed
Audit core::intrinsics for int/uint: size_of/align_of use usize.
Likewise, `fn offset` takes an `isize`.
1 parent e240cb9 commit fc0f6e8

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/libcore/intrinsics.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ pub type GlueFn = extern "Rust" fn(*const i8);
5050
#[derive(Copy)]
5151
pub struct TyDesc {
5252
// sizeof(T)
53-
pub size: uint,
53+
pub size: usize,
5454

5555
// alignof(T)
56-
pub align: uint,
56+
pub align: usize,
5757

5858
// Called when a value of type `T` is no longer needed
5959
pub drop_glue: GlueFn,
@@ -186,15 +186,15 @@ extern "rust-intrinsic" {
186186
/// would *exactly* overwrite a value. When laid out in vectors
187187
/// and structures there may be additional padding between
188188
/// elements.
189-
pub fn size_of<T>() -> uint;
189+
pub fn size_of<T>() -> usize;
190190

191191
/// Move a value to an uninitialized memory location.
192192
///
193193
/// Drop glue is not run on the destination.
194194
pub fn move_val_init<T>(dst: &mut T, src: T);
195195

196-
pub fn min_align_of<T>() -> uint;
197-
pub fn pref_align_of<T>() -> uint;
196+
pub fn min_align_of<T>() -> usize;
197+
pub fn pref_align_of<T>() -> usize;
198198

199199
/// Get a static pointer to a type descriptor.
200200
pub fn get_tydesc<T: ?Sized>() -> *const TyDesc;
@@ -253,7 +253,7 @@ extern "rust-intrinsic" {
253253
///
254254
/// This is implemented as an intrinsic to avoid converting to and from an
255255
/// integer, since the conversion would throw away aliasing information.
256-
pub fn offset<T>(dst: *const T, offset: int) -> *const T;
256+
pub fn offset<T>(dst: *const T, offset: isize) -> *const T;
257257

258258
/// Copies `count * size_of<T>` bytes from `src` to `dst`. The source
259259
/// and destination may *not* overlap.
@@ -294,7 +294,7 @@ extern "rust-intrinsic" {
294294
/// }
295295
/// ```
296296
#[unstable(feature = "core")]
297-
pub fn copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T, count: uint);
297+
pub fn copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T, count: usize);
298298

299299
/// Copies `count * size_of<T>` bytes from `src` to `dst`. The source
300300
/// and destination may overlap.
@@ -324,33 +324,33 @@ extern "rust-intrinsic" {
324324
/// ```
325325
///
326326
#[unstable(feature = "core")]
327-
pub fn copy_memory<T>(dst: *mut T, src: *const T, count: uint);
327+
pub fn copy_memory<T>(dst: *mut T, src: *const T, count: usize);
328328

329329
/// Invokes memset on the specified pointer, setting `count * size_of::<T>()`
330330
/// bytes of memory starting at `dst` to `c`.
331331
#[unstable(feature = "core",
332332
reason = "uncertain about naming and semantics")]
333-
pub fn set_memory<T>(dst: *mut T, val: u8, count: uint);
333+
pub fn set_memory<T>(dst: *mut T, val: u8, count: usize);
334334

335335
/// Equivalent to the appropriate `llvm.memcpy.p0i8.0i8.*` intrinsic, with
336336
/// a size of `count` * `size_of::<T>()` and an alignment of
337337
/// `min_align_of::<T>()`
338338
///
339339
/// The volatile parameter parameter is set to `true`, so it will not be optimized out.
340340
pub fn volatile_copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T,
341-
count: uint);
341+
count: usize);
342342
/// Equivalent to the appropriate `llvm.memmove.p0i8.0i8.*` intrinsic, with
343343
/// a size of `count` * `size_of::<T>()` and an alignment of
344344
/// `min_align_of::<T>()`
345345
///
346346
/// The volatile parameter parameter is set to `true`, so it will not be optimized out.
347-
pub fn volatile_copy_memory<T>(dst: *mut T, src: *const T, count: uint);
347+
pub fn volatile_copy_memory<T>(dst: *mut T, src: *const T, count: usize);
348348
/// Equivalent to the appropriate `llvm.memset.p0i8.*` intrinsic, with a
349349
/// size of `count` * `size_of::<T>()` and an alignment of
350350
/// `min_align_of::<T>()`.
351351
///
352352
/// The volatile parameter parameter is set to `true`, so it will not be optimized out.
353-
pub fn volatile_set_memory<T>(dst: *mut T, val: u8, count: uint);
353+
pub fn volatile_set_memory<T>(dst: *mut T, val: u8, count: usize);
354354

355355
/// Perform a volatile load from the `src` pointer.
356356
pub fn volatile_load<T>(src: *const T) -> T;

0 commit comments

Comments
 (0)