summary refs log tree commit diff
path: root/stack.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stack.h20
1 files changed, 11 insertions, 9 deletions
diff --git a/stack.h b/stack.h
index 4daf6ba..6267f23 100644
--- a/stack.h
+++ b/stack.h
@@ -23,7 +23,9 @@
 
 #include "cards.h"
 
-static Sint8 cardSuit(Sint8 card) {
+typedef Sint8 Card;
+
+static int cardSuit(Card card) {
 	card = abs(card);
 	if (card > Cards_Spade) {
 		return Cards_Spade;
@@ -36,34 +38,34 @@ static Sint8 cardSuit(Sint8 card) {
 	}
 }
 
-static Sint8 cardColor(Sint8 card) {
+static int cardColor(Card card) {
 	return cardSuit(card) == Cards_Diamond || cardSuit(card) == Cards_Heart;
 }
 
-static Sint8 cardRank(Sint8 card) {
+static int cardRank(Card card) {
 	return abs(card) - cardSuit(card);
 }
 
 struct Stack {
 	Uint8 len;
-	Sint8 cards[52];
+	Card cards[52];
 };
 
 static inline void stackClear(struct Stack *stack) {
 	stack->len = 0;
 }
 
-static inline void stackPush(struct Stack *stack, Sint8 card) {
+static inline void stackPush(struct Stack *stack, Card card) {
 	assert(stack->len < 52);
 	stack->cards[stack->len++] = card;
 }
 
-static inline Sint8 stackPop(struct Stack *stack) {
+static inline Card stackPop(struct Stack *stack) {
 	if (!stack->len) return 0;
 	return stack->cards[--stack->len];
 }
 
-static inline Sint8 stackTop(struct Stack *stack) {
+static inline Card stackTop(struct Stack *stack) {
 	if (!stack->len) return 0;
 	return stack->cards[stack->len - 1];
 }
@@ -85,7 +87,7 @@ static inline void stackMoveTo(struct Stack *dst, struct Stack *src, Uint8 n) {
 
 static inline void stackDeck(struct Stack *stack) {
 	stackClear(stack);
-	for (Sint8 i = 1; i <= 52; ++i) {
+	for (Card i = 1; i <= 52; ++i) {
 		stackPush(stack, -i);
 	}
 }
@@ -100,7 +102,7 @@ static inline int randUniform(int bound) {
 static inline void stackShuffle(struct Stack *stack) {
 	for (Uint8 i = stack->len - 1; i > 0; --i) {
 		Uint8 j = randUniform(i + 1);
-		Sint8 x = stack->cards[i];
+		Card x = stack->cards[i];
 		stack->cards[i] = stack->cards[j];
 		stack->cards[j] = x;
 	}
r class='logheader'>2019-09-22Revert "Enable cookies in title"June McEnroe This reverts commit 279111dda15dd9170e11b9688eb973f2af2e6300. 2019-09-20Enable cookies in titleJune McEnroe Perhaps this will make it less suspicious to Google. Who knows. 2019-09-16Use sensitivity aliases in TF2June McEnroe 2019-09-16Add The Just CityJune McEnroe 2019-09-12Only GET the final redirect locationJune McEnroe 2019-09-12Consume entire bodyJune McEnroe Aborting the request and leaving data around may be causing intermittent errors. Just discard the rest of the data. 2019-09-10Add title -v flagJune McEnroe 2019-09-10Use curl error bufferJune McEnroe 2019-09-10Set Accept-Encoding in titleJune McEnroe Because apparently it's fine for servers to respond with Content-Encoding you didn't ask for, and curl won't decode it if you didn't ask for it. 2019-09-08Set title User-AgentJune McEnroe Some things don't like you if you don't send one. 2019-09-07Add -x flag to titleJune McEnroe 2019-09-07Ignore SIGPIPE in relayJune McEnroe Allows restarting consumers safely. 2019-09-07Add A Memory Called EmpireJune McEnroe 2019-09-05Handle lack of Content-TypeJune McEnroe 2019-09-05Use CURLINFO_CONTENT_TYPEJune McEnroe Oops, didn't see this. 2019-09-05Decode entities in titlesJune McEnroe 2019-09-05Print title as soon as it's availableJune McEnroe 2019-09-05Use CURL_PREFIX to set flagsJune McEnroe 2019-09-05Add titleJune McEnroe 2019-09-04Add Avorter n'est pas tuerJune McEnroe 2019-08-29Unset executable on shell scriptsJune McEnroe 2019-08-29Add long-missing setopt to bin.7June McEnroe 2019-08-29Add editJune McEnroe