summaryrefslogtreecommitdiff
path: root/chat.h
diff options
context:
space:
mode:
authorJune McEnroe2022-09-11 17:34:41 -0400
committerJune McEnroe2022-09-11 17:34:41 -0400
commitfcbe7af1e2ac2abb71251a51f5384d22cad9a87a (patch)
treee5583b434defc629f35cf286f69413a1787a610e /chat.h
parentd043bad63ded27b71bf2762f6c07ca1186058cf2 (diff)
Generate /ops from cache
Diffstat (limited to 'chat.h')
-rw-r--r--chat.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/chat.h b/chat.h
index c7053c7..198b84e 100644
--- a/chat.h
+++ b/chat.h
@@ -168,6 +168,19 @@ extern struct Network {
char invex;
} network;
+static inline uint prefixBit(char p) {
+ char *s = strchr(network.prefixes, p);
+ if (!s) return 0;
+ return 1 << (s - network.prefixes);
+}
+
+static inline char bitPrefix(uint p) {
+ for (uint i = 0; network.prefixes[i]; ++i) {
+ if (p & (1 << i)) return network.prefixes[i];
+ }
+ return '\0';
+}
+
#define ENUM_CAP \
X("causal.agency/consumer", CapConsumer) \
X("chghost", CapChghost) \