mirror of
https://github.com/asdlokj1qpi233/subconverter.git
synced 2026-11-03 02:02:24 +00:00
Update build scripts
Optimize codes.
This commit is contained in:
5 files changed
+32
-46
No files matched your search
+3
-3
@@ -23,10 +23,10 @@
|
||||
#define DO_CONCAT(a,b) CONCAT(a,b)
|
||||
template <typename T> class __defer_struct final {private: T fn; bool __cancelled = false; public: __defer_struct(T func) : fn(std::move(func)) {} ~__defer_struct() {if(!__cancelled) fn();} void cancel() {__cancelled = true;} };
|
||||
//#define defer(x) std::unique_ptr<void> DO_CONCAT(__defer_deleter_,__LINE__) (nullptr, [&](...){x});
|
||||
#define defer(x) __defer_struct DO_CONCAT(__defer_deleter,__COUNTER__) ([&](...){x;});
|
||||
#define defer(x) __defer_struct DO_CONCAT(__defer_deleter,__LINE__) ([&](...){x;});
|
||||
|
||||
#define getbit(x,n) (((int)x < 1) ? 0 : ((x >> (n - 1)) & 1))
|
||||
#define setbit(x,n,v) x ^= (-v ^ x) & (1UL << (n - 1))
|
||||
#define GETBIT(x,n) (((int)x < 1) ? 0 : ((x >> (n - 1)) & 1))
|
||||
#define SETBIT(x,n,v) x ^= (-v ^ x) & (1UL << (n - 1))
|
||||
|
||||
typedef std::string::size_type string_size;
|
||||
typedef std::vector<std::string> string_array;
|
||||
|
||||
+1
-1
@@ -1744,7 +1744,7 @@ std::string netchToSingle(std::vector<nodeInfo> &nodes, int types, extra_setting
|
||||
std::string protocol, protoparam, obfs, obfsparam;
|
||||
std::string id, aid, transproto, faketype, host, path, quicsecure, quicsecret;
|
||||
std::string proxyStr, allLinks;
|
||||
bool tlssecure, ss = getbit(types, 1), ssr = getbit(types, 2), vmess = getbit(types, 3), trojan = getbit(types, 4);
|
||||
bool tlssecure, ss = GETBIT(types, 1), ssr = GETBIT(types, 2), vmess = GETBIT(types, 3), trojan = GETBIT(types, 4);
|
||||
|
||||
for(nodeInfo &x : nodes)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user