Довольно часто мне нужно упаковать 2 инта в лонг, или из лога получить 2 инта, ну или в шортов сделать инт и т.д. Это применяется в основном в каких-нибудь Dictionary (или подобных кейсах) в виде ключей, чтобы не городить структуру, да и работать оно будет быстрее.
void ToInts(long a, out int a1, out int a2) { a1 = (int)(a & uint.MaxValue); a2 = (int)(a >> 32); }
long ToLong(int a1, int a2) { long b = a2; b = b << 32; b = b | (uint)a1; return b; }
Довольно часто мне нужно упаковать 2 инта в лонг, или из лога получить 2 инта, ну или в шортов сделать инт и т.д. Это применяется в основном в каких-нибудь Dictionary (или подобных кейсах) в виде ключей, чтобы не городить структуру, да и работать оно будет быстрее.
void ToInts(long a, out int a1, out int a2) { a1 = (int)(a & uint.MaxValue); a2 = (int)(a >> 32); }
long ToLong(int a1, int a2) { long b = a2; b = b << 32; b = b | (uint)a1; return b; }
Clear Content is editable within two days of publishing During a meeting with the president of the Supreme Electoral Court (TSE) on June 6, Telegram's Vice President Ilya Perekopsky announced the initiatives. According to the executive, Brazil is the first country in the world where Telegram is introducing the features, which could be expanded to other countries facing threats to democracy through the dissemination of false content. How to create a business channel on Telegram? (Tutorial) End-to-end encryption is an important feature in messaging, as it's the first step in protecting users from surveillance.
from us