From 9344bd828cd391c25dc5ee6b4699b0025791a8f8 Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Sat, 1 Aug 2015 15:21:41 -0700 Subject: [PATCH] Clarify comments on setentry invariants. --- Include/setobject.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Include/setobject.h b/Include/setobject.h index f17bc1b0354..87ec1c8afc0 100644 --- a/Include/setobject.h +++ b/Include/setobject.h @@ -10,12 +10,13 @@ extern "C" { /* There are three kinds of entries in the table: -1. Unused: key == NULL -2. Active: key != NULL and key != dummy -3. Dummy: key == dummy +1. Unused: key == NULL and hash == 0 +2. Dummy: key == dummy and hash == -1 +3. Active: key != NULL and key != dummy and hash != -1 -The hash field of Unused slots have no meaning. -The hash field of Dummny slots are set to -1 +The hash field of Unused slots is always zero. + +The hash field of Dummy slots are set to -1 meaning that dummy entries can be detected by either entry->key==dummy or by entry->hash==-1. */