aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpollney <pollney@a491c6a4-70bf-4b89-8b36-d6c0cb1f094e>2003-05-22 08:33:50 +0000
committerpollney <pollney@a491c6a4-70bf-4b89-8b36-d6c0cb1f094e>2003-05-22 08:33:50 +0000
commit0481cfb5f8b8f4fa31ae5aeecb9b636053c2c904 (patch)
tree3dfff44e8c51cf469227b194c9b25cec1fbbf668
parente45304e4e4ec3115662da845fdbb48aff4caecb7 (diff)
SpaceMask_GetStateBits() returns -1 on error.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/SpaceMask/trunk@30 a491c6a4-70bf-4b89-8b36-d6c0cb1f094e
-rw-r--r--doc/documentation.tex7
-rw-r--r--src/MaskUtils.c5
2 files changed, 8 insertions, 4 deletions
diff --git a/doc/documentation.tex b/doc/documentation.tex
index 349de9b..d6adc5d 100644
--- a/doc/documentation.tex
+++ b/doc/documentation.tex
@@ -199,9 +199,12 @@ bitmask corresponding to the given type or state. For example, if a
given type uses three bits of the mask, the returned value could be
the integer corresponding to the bitfield $001110000$\ldots, where the
location of $1$s indicates the bits which have been allocated to the
-given type. A return value of $0$ indicates that the bitmask could
+given type. A return value of $-1$ indicates that the bitmask could
not be determined for some reason (for example, the requested state
-was not previously registered).
+was not previously registered)\footnote{Note that a potential
+ambiguity arises here, in that if the full mask is allocated to a
+single type, then $-1$ is a valid state. It is assumed that this
+eventuality won't arise in practice.}.
The following macros have been defined for fast setting and checking
of the mask by direct bitwise operations:
diff --git a/src/MaskUtils.c b/src/MaskUtils.c
index ad9e5e6..784f5b0 100644
--- a/src/MaskUtils.c
+++ b/src/MaskUtils.c
@@ -422,7 +422,8 @@ SpaceMask_GetTypeBits(const char* type_name)
@author Denis Pollney
@date 15 October 2002
@desc
- Returns the bitmask corresponding to the given state.
+ Returns the bitmask corresponding to the given state, or
+ -1 if the state does not exist.
@enddesc
@@*/
@@ -449,7 +450,7 @@ SpaceMask_GetStateBits(const char* type_name, const char* state_name)
"Requested state \"%s\" could not be found in type \"%s\"\n",
state_name, type_name);
- return 0;
+ return -1;
}
/*@@