Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
3225b04c
R
Rust
项目概览
int
/
Rust
大约 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3225b04c
编写于
4月 01, 2015
作者:
F
Felix S. Klock II
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fallout from feature-gating unary negation on unsigned integers.
上级
d8e30932
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
27 addition
and
11 deletion
+27
-11
src/libcollections/slice.rs
src/libcollections/slice.rs
+1
-1
src/libcore/atomic.rs
src/libcore/atomic.rs
+1
-1
src/libcore/cell.rs
src/libcore/cell.rs
+1
-1
src/libcore/num/mod.rs
src/libcore/num/mod.rs
+1
-1
src/libcore/ops.rs
src/libcore/ops.rs
+20
-4
src/libcore/str/mod.rs
src/libcore/str/mod.rs
+1
-1
src/liblibc/lib.rs
src/liblibc/lib.rs
+1
-1
src/libstd/rt/mod.rs
src/libstd/rt/mod.rs
+1
-1
未找到文件。
src/libcollections/slice.rs
浏览文件 @
3225b04c
...
...
@@ -1123,7 +1123,7 @@ impl Iterator for ElementSwaps {
// #[inline]
fn
next
(
&
mut
self
)
->
Option
<
(
usize
,
usize
)
>
{
fn
new_pos_wrapping
(
i
:
usize
,
s
:
Direction
)
->
usize
{
i
.wrapping_add
(
match
s
{
Pos
=>
1
,
Neg
=>
-
1
})
i
.wrapping_add
(
match
s
{
Pos
=>
1
,
Neg
=>
!
0
/* aka -1 */
})
}
fn
new_pos
(
i
:
usize
,
s
:
Direction
)
->
usize
{
...
...
src/libcore/atomic.rs
浏览文件 @
3225b04c
...
...
@@ -161,7 +161,7 @@ pub enum Ordering {
AtomicUsize
{
v
:
UnsafeCell
{
value
:
0
,
}
};
// NB: Needs to be -1 (0b11111111...) to make fetch_nand work correctly
const
UINT_TRUE
:
usize
=
-
1
;
const
UINT_TRUE
:
usize
=
!
0
;
impl
AtomicBool
{
/// Creates a new `AtomicBool`.
...
...
src/libcore/cell.rs
浏览文件 @
3225b04c
...
...
@@ -287,7 +287,7 @@ pub enum BorrowState {
// (will not outgrow its range since `usize` is the size of the address space)
type
BorrowFlag
=
usize
;
const
UNUSED
:
BorrowFlag
=
0
;
const
WRITING
:
BorrowFlag
=
-
1
;
const
WRITING
:
BorrowFlag
=
!
0
;
impl
<
T
>
RefCell
<
T
>
{
/// Creates a new `RefCell` containing `value`.
...
...
src/libcore/num/mod.rs
浏览文件 @
3225b04c
...
...
@@ -517,7 +517,7 @@ fn one() -> $T { 1 }
fn
min_value
()
->
$T
{
0
}
#[inline]
fn
max_value
()
->
$T
{
-
1
}
fn
max_value
()
->
$T
{
!
0
}
#[inline]
fn
count_ones
(
self
)
->
u32
{
...
...
src/libcore/ops.rs
浏览文件 @
3225b04c
...
...
@@ -482,8 +482,10 @@ pub trait Neg {
fn
neg
(
self
)
->
Self
::
Output
;
}
macro_rules!
neg_impl
{
(
$
(
$t:ty
)
*
)
=>
(
$
(
macro_rules!
neg_impl_core
{
(
$id:ident
=>
$body:expr
,
$
(
$t:ty
)
*
)
=>
(
$
(
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
#[allow(unsigned_negation)]
impl
Neg
for
$t
{
...
...
@@ -492,14 +494,28 @@ impl Neg for $t {
#[inline]
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
fn
neg
(
self
)
->
$t
{
-
self
}
fn
neg
(
self
)
->
$t
{
let
$id
=
self
;
$body
}
}
forward_ref_unop!
{
impl
Neg
,
neg
for
$t
}
)
*
)
}
neg_impl!
{
usize
u8
u16
u32
u64
isize
i8
i16
i32
i64
f32
f64
}
macro_rules!
neg_impl_numeric
{
(
$
(
$t:ty
)
*
)
=>
{
neg_impl_core!
{
x
=>
-
x
,
$
(
$t
)
*
}
}
}
macro_rules!
neg_impl_unsigned
{
(
$
(
$t:ty
)
*
)
=>
{
neg_impl_core!
{
x
=>
{
#[cfg(stage0)]
use
::
num
::
wrapping
::
WrappingOps
;
!
x
.wrapping_add
(
1
)
},
$
(
$t
)
*
}
}
}
neg_impl_unsigned!
{
usize
u8
u16
u32
u64
}
neg_impl_numeric!
{
isize
i8
i16
i32
i64
f32
f64
}
/// The `Not` trait is used to specify the functionality of unary `!`.
///
...
...
src/libcore/str/mod.rs
浏览文件 @
3225b04c
...
...
@@ -873,7 +873,7 @@ fn next(&mut self, haystack: &[u8], needle: &[u8], long_period: bool)
#[allow(dead_code)]
#[allow(deprecated)]
fn
maximal_suffix
(
arr
:
&
[
u8
],
reversed
:
bool
)
->
(
usize
,
usize
)
{
let
mut
left
:
usize
=
-
1
;
// Corresponds to i in the paper
let
mut
left
:
usize
=
!
0
;
// Corresponds to i in the paper
let
mut
right
=
0
;
// Corresponds to j in the paper
let
mut
offset
=
1
;
// Corresponds to k in the paper
let
mut
period
=
1
;
// Corresponds to p in the paper
...
...
src/liblibc/lib.rs
浏览文件 @
3225b04c
...
...
@@ -4696,7 +4696,7 @@ pub mod posix88 {
pub
const
MAP_FIXED
:
c_int
=
0x0010
;
pub
const
MAP_ANON
:
c_int
=
0x1000
;
pub
const
MAP_FAILED
:
*
mut
c_void
=
-
1
as
*
mut
c_void
;
pub
const
MAP_FAILED
:
*
mut
c_void
=
!
0
as
*
mut
c_void
;
pub
const
MCL_CURRENT
:
c_int
=
0x0001
;
pub
const
MCL_FUTURE
:
c_int
=
0x0002
;
...
...
src/libstd/rt/mod.rs
浏览文件 @
3225b04c
...
...
@@ -117,7 +117,7 @@ fn lang_start(main: *const u8, argc: isize, argv: *const *const u8) -> isize {
use
libc
;
use
libc
::
funcs
::
posix01
::
signal
::
signal
;
unsafe
{
assert
!
(
signal
(
libc
::
SIGPIPE
,
libc
::
SIG_IGN
)
!=
-
1
);
assert
!
(
signal
(
libc
::
SIGPIPE
,
libc
::
SIG_IGN
)
!=
!
0
);
}
}
ignore_sigpipe
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录