026ddc3
Extract common expression in variable pSnapshot
- Robyt3
93d6691
Use nullptr
instead of 0
and 0x0
- Robyt3
8f9a445
Remove unnecessary RangeCheck
function - Robyt3
0472808
Add assertions for CSnapshotDelta::SetStaticsize
parameters - Robyt3
f5ed415
Mark functions and pointers as const
- Robyt3
0ff2c5b
Use size_t
and add assertions for CSnapshotStorage::Add
- Robyt3
3607e8e
Merge pull request #7581 from Robyt3/Snapshot-Refactoring - heinrich5991window.open('', '_self').close();
instead of window.close()
(edited)window.open('', '_self').close();
instead of window.close()
(edited)window.close()
works, right @murpi ? let src_range = src..(src + len);
let dst_range = dst..(dst + len);
let src_range = src..(src + len);
let dst_range = dst..(dst + len);
Copy
which is very annoyingCopy
which is very annoying Copy
for iteratorsgit merge upstream/master --ff-only
git reset
to me (edited)git merge upstream/master --ff-only
git pull
or bare git push
❯ ccache -s
Cacheable calls: 26205 / 31963 (81.99%)
Hits: 4479 / 26205 (17.09%)
Direct: 4129 / 4479 (92.19%)
Preprocessed: 350 / 4479 ( 7.81%)
Misses: 21726 / 26205 (82.91%)
Uncacheable calls: 5758 / 31963 (18.01%)
Local storage:
Cache size (GB): 8.2 / 50.0 (16.43%)
Hits: 4479 / 26205 (17.09%)
Misses: 21726 / 26205 (82.91%)
this after compiling llvm several times after making my prgit pull
or bare git push
fetch
+merge
/reset
to pull
push
tho. What do you do?push
with*.try_into().unwrap()
StrRef
instead of a *const c_char
std::optional
?std::optional
? std::optional
? pub enum MyFFIOpaqueStruct {}
LLVMTarget
enum in crate llvm_sys
.#[derive(Debug)]
pub enum LLVMTarget {}
pub type LLVMTargetRef = *mut LLVMTarget;
struct A {
b: ()
}
struct A {
b: ()
}
_non_constructible: ()
seems about right to me#[non_exhaustive]
these days IIRC*const Void
is such an intuitive way to model it except for the facy that you can instantiate empty types with unsafe*const Void
is such an intuitive way to model it except for the facy that you can instantiate empty types with unsafe c_void
is actually modeled as an empty struct these daysvoid
type when used as a pointer.struct A {
b: ()
}
#[doc = include_str!("c_void.md")]
#[lang = "c_void"]
#[cfg_attr(not(doc), repr(u8))] // work around https://github.com/rust-lang/rust/issues/90435
#[stable(feature = "core_c_void", since = "1.30.0")]
pub enum c_void {
#[unstable(
feature = "c_void_variant",
reason = "temporary implementation detail",
issue = "none"
)]
#[doc(hidden)]
__variant1,
#[unstable(
feature = "c_void_variant",
reason = "temporary implementation detail",
issue = "none"
)]
#[doc(hidden)]
__variant2,
}
(edited)#[doc = include_str!("c_void.md")]
#[lang = "c_void"]
#[cfg_attr(not(doc), repr(u8))] // work around https://github.com/rust-lang/rust/issues/90435
#[stable(feature = "core_c_void", since = "1.30.0")]
pub enum c_void {
#[unstable(
feature = "c_void_variant",
reason = "temporary implementation detail",
issue = "none"
)]
#[doc(hidden)]
__variant1,
#[unstable(
feature = "c_void_variant",
reason = "temporary implementation detail",
issue = "none"
)]
#[doc(hidden)]
__variant2,
}
(edited)#[non_exhaustive]
pretty much does this, except for the panicking#[lang = "va_list"]
pub struct VaListImpl<'f> {
ptr: *mut c_void,
// Invariant over `'f`, so each `VaListImpl<'f>` object is tied to
// the region of the function it's defined in
_marker: PhantomData<&'f mut &'f c_void>,
}
#[lang = "va_list"]
pub struct VaListImpl<'f> {
ptr: *mut c_void,
// Invariant over `'f`, so each `VaListImpl<'f>` object is tied to
// the region of the function it's defined in
_marker: PhantomData<&'f mut &'f c_void>,
}
#[lang = "…"]
dbg_assert
s in codeconst unsigned char SERVERBROWSE_GETINFO[SERVERBROWSE_SIZE] = {255, 255, 255, 255, 'g', 'i', 'e', '3'};
const unsigned char SERVERBROWSE_INFO[SERVERBROWSE_SIZE] = {255, 255, 255, 255, 'i', 'n', 'f', '3'};
const unsigned char SERVERBROWSE_GETINFO_64_LEGACY[SERVERBROWSE_SIZE] = {255, 255, 255, 255, 'f', 's', 't', 'd'};
const unsigned char SERVERBROWSE_INFO_64_LEGACY[SERVERBROWSE_SIZE] = {255, 255, 255, 255, 'd', 't', 's', 'f'};
const unsigned char SERVERBROWSE_INFO_EXTENDED[SERVERBROWSE_SIZE] = {255, 255, 255, 255, 'i', 'e', 'x', 't'};
const unsigned char SERVERBROWSE_INFO_EXTENDED_MORE[SERVERBROWSE_SIZE] = {255, 255, 255, 255, 'i', 'e', 'x', '+'};
const unsigned char SERVERBROWSE_CHALLENGE[SERVERBROWSE_SIZE] = {255, 255, 255, 255, 'c', 'h', 'a', 'l'};
(edited)CGenericJob
that was a template that could take any function, for a bit, but then I rewrote without itCGenericJob
that was a template that could take any function, for a bit, but then I rewrote without it let numbers = lines
.next()
.unwrap()
.split_once(": ")
.unwrap()
.1
.split_ascii_whitespace()
.map(|x| x.parse::<u64>().unwrap())
.collect_vec();
lines.nth(1);
\n
is completely fine for C\n
is completely fine for C let s = "231231...312";
I want s.parse::<i32>()
to give me 231231
, it's not that difficult, we've been doing it since 1990 no problemlet s = "231231...312";
I want s.parse::<i32>()
to give me 231231
, it's not that difficult, we've been doing it since 1990 no problem strtol
is defined the way it isstrtol
is defined the way it is for(;;) {
int k = strtol(s, &s, 10);
while(*s++ == ',' || s == ' ');
// do sth with k
}
(edited)nom
parts of the input, which is why an entire rust crate exists around the usecase&[u8]
to integer parsernom
parts of the input, which is why an entire rust crate exists around the usecase split
works?Spliterator
iirc it was calledlet s = "231231...312";
I want s.parse::<i32>()
to give me 231231
, it's not that difficult, we've been doing it since 1990 no problem int k = strtol(s, &s, 10);
if(*s != ' ')
abort()
int k = strtol(s, &s, 10);
if(*s != ' ')
abort()
Result
and ?
like Rust and we wouldn't need errno and that line would just need a ?
insteadas_ptr
isn't a method for Rc
?as_ptr
isn't a method for Rc
? TryInto::<usize>::try_into(p.1).unwrap()
this might be the ugliest thing I've ever written as_ptr
isn't a method for Rc
? as_ptr
isn't a method for Rc
? for dy in -1i64..2 {
for dx in -1i64..2 {
// check bounds
if (y == 0 && dy < 0)
|| (y == (height - 1) && dy > 0)
|| (x == 0 && dx < 0)
|| (x == (width - 1) && dx > 0)
{
continue;
}
let coordy = ((y as i64) + dy) as usize;
let coordx = ((x as i64) + dx) as usize;
let v = input.get(coordy).and_then(|a| a.get(coordx)).unwrap();
if !v.is_ascii_digit() && *v == '*' && !current_num.is_empty() {
is_part_num = Some((coordx, coordy));
}
}
}
2 . 2
. * .
2 . 2
let br = Point(map[0].len().try_into().unwrap(), map.len().try_into().unwrap());
222
.*.
...
let br = Point(map[0].len().try_into().unwrap(), map.len().try_into().unwrap());
222
.*.
...
p.1.try_into().unwrap()
if let Tile::Num(n) = &map[TryInto::<usize>::try_into(p.1).unwrap()]
[TryInto::<usize>::try_into(p.0).unwrap()]
{
nums.insert(Rc::as_ptr(n));
}
if let
which surestd::shared_ptr
s to one thing won't compare equal#[stable(feature = "rust1", since = "1.0.0")]
trait RcEqIdent<T: ?Sized + PartialEq, A: Allocator> {
fn eq(&self, other: &Rc<T, A>) -> bool;
fn ne(&self, other: &Rc<T, A>) -> bool;
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<T: ?Sized + PartialEq, A: Allocator> RcEqIdent<T, A> for Rc<T, A> {
#[inline]
default fn eq(&self, other: &Rc<T, A>) -> bool {
**self == **other
}
#[inline]
default fn ne(&self, other: &Rc<T, A>) -> bool {
**self != **other
}
}
std::shared_ptr
implements the exact same thing yet won't behave the same2 . 2
. * .
2 . 2
2 . 2
. * .
2 . 2
2 . 2
. * .
2 . 2
a.rs
and do a nice rustc --edition 2021 a.rs
std::shared_ptr
s to one thing won't compare equal Rc<T>
as T
syntactically, which is why the comparison behaviour isn't too too unexpected*
is pretty much non existant->
not .
TryInto::<usize>::try_into(p.1).unwrap()
this might be the ugliest thing I've ever written p.1.try_into().unwrap()
didn't work?as_ptr()
was a method instead, and we had an Rc<Vec<_>>
and called .as_ptr()
would it resolve to Rc::as_ptr()
?p.1.try_into().unwrap()
didn't work? rustc
rustc
Cargo.toml
exists somewhereas_ptr()
was a method instead, and we had an Rc<Vec<_>>
and called .as_ptr()
would it resolve to Rc::as_ptr()
? Cargo.toml
exists somewhere sv_vote_time
caused the vote network messages to be discarded with the error message weird message 'Sv_VoteSet' (15), failed on 'm_Timeout'
by the client, as the protocol did not allow longer vote timeouts.
This adds no backwards compatibility for old clients. Old clients will not be able to see votes which are started with a timeout longer than 60 seconds.
Closes #7583.
sv_vote_time
to 60 again? That doesn't really solve murpi's issue for now I guess.sv_vote_time
to 60 again? That doesn't really solve murpi's issue for now I guess. sv_vote_time
's maximum to 60LineSpacing
parameter to render the text in order to keep things consistent for 1 line entries and multiline entries.
I've tested it on multiple different resolutions and it seems to work quite well.
https://github.com/ddnet/ddnet/assets/13364635/4a77901f...