acc=1532
acc=
490a436
Remove failing blocklist_driver tests - heinrich5991
59cbc01
Bump minimum CMake version from 2.8 to 2.8.12 - heinrich5991
abd2a54
Bump to gtest from a commit SHA to 1.10.1 - heinrich5991
037b928
Manually patch gtest to allow CMake version 2.8.12...3.19.1 - heinrich5991
56a90c2
Merge #3387 - bors[bot]ninja -v
or make VERBOSE=1
target_sources
(edited)--- a/src/game/editor/io.cpp
+++ b/src/game/editor/io.cpp
@@ -560,6 +560,10 @@ int CEditorMap::Save(class IStorage *pStorage, const char *pFileName)
df.AddItem(MAPITEMTYPE_ENVPOINTS, 0, TotalSize, pPoints);
free(pPoints);
}
+ else
+ {
+ df.AddItem(MAPITEMTYPE_ENVPOINTS, 0, 0, NULL);
+ }
// finish the data file
df.Finish();
(edited)$ [ "${BASH_VERSINFO:-0}" -ge 4 ] && echo "bash supports associative arrays"
is still supirior ofcsizeof (wchar_t)
returns 2 on Windows while it returns 4 everywhere else pc
which should probably be of type usize
because it indexes the vector of instructions and I compare it to the length of the vector of instructions. But I want to add ani32
to pc
which can be negative. I don't want to fail silently on conversions, thus I can't use as
. How should I solve this? I have 2 solutions in mind:
1. When adding to pc
convert pc
to i32
first and then the result back to usize
like this pc = usize::try_from(i32::try_from(pc).unwrap() + x).unwrap()
2. Make pc
an i32
instead and everywhere were I need usize
writeusize::try_from(pc).unwrap()
pc as usize
for i in &mut instr {
if let Instr::ACC(a) = *i {
*i = Instr::NOP(a);
} else if let Instr::NOP(a) = *i {
*i = Instr::ACC(a);
}
if let SimResult::Term(acc) = simulate(&instr) {
println!("Found solution, accumulator is {}", acc);
}
}
error[E0502]: cannot borrow `instr` as immutable because it is also borrowed as mutable
--> src/main.rs:62:48
|
56 | for i in &mut instr {
| ----------
| |
| mutable borrow occurs here
| mutable borrow later used here
...
62 | if let SimResult::Term(acc) = simulate(&instr) {
| ^^^^^^ immutable borrow occurs here
Vec<Instr>
for i in 0..instr.len() {
if let Instr::JMP(a) = instr[i] {
instr[i] = Instr::NOP(a);
} else if let Instr::NOP(a) = instr[i] {
instr[i] = Instr::JMP(a);
}
if let SimResult::Term(acc) = simulate(&instr) {
println!("Found solution, accumulator is {}", acc);
}
if let Instr::JMP(a) = instr[i] {
instr[i] = Instr::NOP(a);
} else if let Instr::NOP(a) = instr[i] {
instr[i] = Instr::JMP(a);
}
}
let mut v = vec![1, 2, 3, 4, 5];
let first = &v[0];
v.push(6);
println!("The first element is: {}", first);
I was like why doesn't it compile. But the explanation is
Cell
set
and get
which only take a constant referencex.iter()
or x.iter_mut()
in the parameter of a for loop @Ryozuki. use &x
or &mut x
insteads/pData->m_pResult/pResult/g
) causing a rather big diff. This was necessary, since the database worker has to access the result for each query to notify when a query is complete.