Minor changes to vendor:ENet

This commit is contained in:
gingerBill
2024-08-14 14:09:36 +01:00
parent eb6f2078cf
commit 03dd38f203
4 changed files with 34 additions and 34 deletions
+8 -8
View File
@@ -12,21 +12,21 @@ import "core:c"
fds_bits: [FD_SETSIZE / 8 / size_of(c.long)]c.ulong,
}
@(private="file") FD_ZERO :: #force_inline proc(s: ^fd_set) {
@(private="file") FD_ZERO :: #force_inline proc "contextless" (s: ^fd_set) {
for i := size_of(fd_set) / size_of(c.long); i != 0; i -= 1 {
s.fds_bits[i] = 0
}
}
@(private="file") FD_SET :: #force_inline proc(d: i32, s: ^fd_set) {
@(private="file") FD_SET :: #force_inline proc "contextless" (d: i32, s: ^fd_set) {
s.fds_bits[d / (8 * size_of(c.long))] |= c.ulong(1) << (c.ulong(d) % (8 * size_of(c.ulong)))
}
@(private="file") FD_CLR :: #force_inline proc(d: i32, s: ^fd_set) {
@(private="file") FD_CLR :: #force_inline proc "contextless" (d: i32, s: ^fd_set) {
s.fds_bits[d / (8 * size_of(c.long))] &~= c.ulong(1) << (c.ulong(d) % (8 * size_of(c.ulong)))
}
@(private="file") FD_ISSET :: #force_inline proc(d: i32, s: ^fd_set) -> bool {
@(private="file") FD_ISSET :: #force_inline proc "contextless" (d: i32, s: ^fd_set) -> bool {
return (s.fds_bits[d / (8 * size_of(c.long))] & c.ulong(1) << (c.ulong(d) % (8 * size_of(c.ulong)))) != 0
}
// }
@@ -42,18 +42,18 @@ Buffer :: struct {
SocketSet :: distinct fd_set
SOCKETSET_EMPTY :: #force_inline proc(sockset: ^SocketSet) {
SOCKETSET_EMPTY :: #force_inline proc "contextless" (sockset: ^SocketSet) {
FD_ZERO(cast(^fd_set)sockset)
}
SOCKETSET_ADD :: #force_inline proc(sockset: ^SocketSet, socket: Socket) {
SOCKETSET_ADD :: #force_inline proc "contextless" (sockset: ^SocketSet, socket: Socket) {
FD_SET(i32(socket), cast(^fd_set)sockset)
}
SOCKETSET_REMOVE :: #force_inline proc(sockset: ^SocketSet, socket: Socket) {
SOCKETSET_REMOVE :: #force_inline proc "contextless" (sockset: ^SocketSet, socket: Socket) {
FD_CLR(i32(socket), cast(^fd_set)sockset)
}
SOCKSET_CHECK :: #force_inline proc(sockset: ^SocketSet, socket: Socket) -> bool {
SOCKSET_CHECK :: #force_inline proc "contextless" (sockset: ^SocketSet, socket: Socket) -> bool {
return FD_ISSET(i32(socket), cast(^fd_set)sockset)
}