c++
constexpr unsigned char c = std::add_sat(UCHAR_MAX, 4); // not saturated, T = int
// add_sat(int, int) returns int tmp == 259,
// then assignment truncates 259 % 256 == 3
static_assert(c == 3);
fn a<T: Into<PathBuf>(x: T) {
b(x.into())
}
fn b(x: PathBuf) { big here }
TextEx
calls it worksGetViewportSize
m_vpAll
prefixes and stuff&mut
&mut
Nullable<>
template. any pointer not in a Nullable
must be non-nullNullable<>
template. any pointer not in a Nullable
must be non-null if
statementsif
statements TextEx
function is also called in other places like the scoreboard, which does not cause this issueTextEx
function is also called in other places like the scoreboard, which does not cause this issue QuadContainerAddQuads
causesQuadContainerAddQuads
causes TextContainer.m_StringInfo.m_SelectionQuadContainerIndex = Graphics()->CreateQuadContainer(false);
and it's happening even that I just opened console is it fine ?TextContainer.m_StringInfo.m_SelectionQuadContainerIndex = Graphics()->CreateQuadContainer(false);
and it's happening even that I just opened console is it fine ? Cursor.m_* = *
linesm_SelectionQuadContainerIndex
in text.cpp
also fixes itQuadContainerAddQuads
calls is enoughContainer.m_QuadBufferObjectIndex = CreateBufferObject(UploadDataSize, Container.m_vQuads.data(), 0);
watch -n 0.1 'sudo pmap -x 78543 | grep "gesamt"'
where 78543 is my pid of DDNetm_Elements.erase(...)
in backend_vulkan.cpp
?m_Elements.erase(...)
in backend_vulkan.cpp
? watch -n 0.1 'sudo pmap -x 78543 | grep "gesamt"'
where 78543 is my pid of DDNet sudo watch -n 0.1 'pmap -x 78543 | grep "gesamt"'
char aBuf[128];
CImageInfo Info;
str_format(aBuf, sizeof(aBuf), "/path/to/file.png");
Graphics()->LoadPNG(&Info, aBuf, IStorage::TYPE_ABSOLUTE);
auto Handle = Graphics()->LoadTextureRaw(Info.m_Width, Info.m_Height, Info.m_Format, Info.m_pData, 0);
Graphics()->TextureSet(Handle);
Graphics()->QuadsBegin();
Graphics()->DrawRectExt(100, 100, 100, 100, 0, 0);
Graphics()->QuadsEnd();
s
to State
.
char aBuf[128];
CImageInfo Info;
str_format(aBuf, sizeof(aBuf), "/path/to/file.png");
Graphics()->LoadPNG(&Info, aBuf, IStorage::TYPE_ABSOLUTE);
auto Handle = Graphics()->LoadTextureRaw(Info.m_Width, Info.m_Height, Info.m_Format, Info.m_pData, 0);
Graphics()->TextureSet(Handle);
Graphics()->QuadsBegin();
Graphics()->DrawRectExt(100, 100, 100, 100, 0, 0);
Graphics()->QuadsEnd();
LoadPNG
every frame, but you do you! :Dstd::string_view
is such a meh abstraction over strings, not guaranteeing null termination was such a bad idea, it's basically completely useless for interoperability with any already existing codestd::string_view
is such a meh abstraction over strings, not guaranteeing null termination was such a bad idea, it's basically completely useless for interoperability with any already existing code std::string_view
is such a meh abstraction over strings, not guaranteeing null termination was such a bad idea, it's basically completely useless for interoperability with any already existing code a.len() == b.len() && memcmp(a.data(), b.data(), a.len()) == 0
(edited)ifstream
open(2)
typedef struct
{
ptrdiff_t len;
unsigned char* str;
} s8;
#define s8(s) (s8) { ((ptrdiff_t) sizeof(s)-1), (unsigned char*)s }
open(2)
O(n)
strlen in Rust tooO(n)
strlen in Rust too O(n)
for one type of string and O(1)
for the other. If you don't need strlen for your "operation" it's not a cost you payO(n)
for one type of string and O(1)
for the other. If you don't need strlen for your "operation" it's not a cost you pay class LLVM_GSL_POINTER StringRef {
public:
static constexpr size_t npos = ~size_t(0);
using iterator = const char *;
using const_iterator = const char *;
using size_type = size_t;
private:
/// The start of the string, in an external buffer.
const char *Data = nullptr;
/// The length of the string.
size_t Length = 0;
// Workaround memcmp issue with null pointers (undefined behavior)
// by providing a specialized version
static int compareMemory(const char *Lhs, const char *Rhs, size_t Length) {
if (Length == 0) { return 0; }
return ::memcmp(Lhs,Rhs,Length);
}
strlen
vectorized, and after that it's equivalent to whatever you'd do with length prefixed stringsstrlen
vectorized, and after that it's equivalent to whatever you'd do with length prefixed strings /dev/fb0
? @Jupstar ✪/dev/fb0
? @Jupstar ✪ >>> 1.0/0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ZeroDivisionError: float division by zero
not really bro, not really>>>
KeyboardInterrupt
>>>
KeyboardInterrupt
>>>
KeyboardInterrupt
>>>
KeyboardInterrupt
>>> quit
Use quit() or Ctrl-D (i.e. EOF) to exit
LMAO./sysdeps/x86_64/multiarch/strcpy-sse2.S
I looked at the sse2 one./sysdeps/x86_64/multiarch/strcpy-sse2.S
I looked at the sse2 one \0
is technically free game. e.g. strlens implementation knows nothing about the object size limitsexceeds maximum object size 9223372036854775807
(which is PTRDIFF_MAX)