Skip to content

Commit 4307186

Browse files
committed
---
yaml --- r: 47720 b: refs/heads/incoming c: 5c75f21 h: refs/heads/master v: v3
1 parent 8536b11 commit 4307186

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 2a8fb58d79e685d5ca07b039badcf2ae3ef077ea
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/incoming: 59bb9c2f1a85007c4b399767ecb98885e349aa2e
9+
refs/heads/incoming: 5c75f210ba6e450fb1603b50ca0a4805f13173d7
1010
refs/heads/dist-snap: 8b98e5a296d95c5e832db0756828e5bec31c6f50
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/src/etc/vim/syntax/rust.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ syn match rustAssert "\<assert\(\w\)*"
1414
syn keyword rustKeyword as break
1515
syn keyword rustKeyword copy do drop else extern
1616
syn keyword rustKeyword for if impl let log
17-
syn keyword rustKeyword loop match mod move once priv pub pure
17+
syn keyword rustKeyword loop match mod once priv pub pure
1818
syn keyword rustKeyword ref return static
1919
syn keyword rustKeyword unsafe use while
2020
" FIXME: Scoped impl's name is also fallen in this category

branches/incoming/src/rt/rust_util.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,21 @@ extern struct type_desc str_body_tydesc;
1919

2020
// Inline fn used regularly elsewhere.
2121

22+
static inline size_t
23+
next_power_of_two(size_t s)
24+
{
25+
size_t tmp = s - 1;
26+
tmp |= tmp >> 1;
27+
tmp |= tmp >> 2;
28+
tmp |= tmp >> 4;
29+
tmp |= tmp >> 8;
30+
tmp |= tmp >> 16;
31+
#ifdef _LP64
32+
tmp |= tmp >> 32;
33+
#endif
34+
return tmp + 1;
35+
}
36+
2237
// Rounds |size| to the nearest |alignment|. Invariant: |alignment| is a power
2338
// of two.
2439
template<typename T>
@@ -76,6 +91,10 @@ inline void reserve_vec_exact(rust_task* task, rust_vec_box** vpp,
7691
}
7792
}
7893

94+
inline void reserve_vec(rust_task* task, rust_vec_box** vpp, size_t size) {
95+
reserve_vec_exact(task, vpp, next_power_of_two(size));
96+
}
97+
7998
typedef rust_vec_box rust_str;
8099

81100
inline rust_str *

0 commit comments

Comments
 (0)