Update build scripts

Optimize codes.
This commit is contained in:
Tindy X committed 2020-07-01 01:14:03 +08:00
1 parent 5aa47c7cf2
commit f9eba5b179
5 files changed
+32 -46

No files matched your search

+3 -3
View File
@@ -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
View File
@@ -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)
{