Approved for inclusion in a future ANSI M[UMPS] language standard as part of the library for cyclic redundancy checks.
This function computes a Cyclic Redundancy Code of the 8-bit character string string, using X32 + X26 + X23 + X22 + X16 + X12 + X11 + X10 + X8 + X7 + X5 + X4 + X2 + X + 1 as the polynomial. The optional parameter seed may supply an initial value, which allows for running CRC calculations on multiple strings. If the parameter seed is not specified, a default value of 4,294,967,295 (232-1) is assumed. The value of seed is limited to 0 seed < 232. The function value will be between 0 and 232.
A typical method of transmitting data is to send data followed by a check-sum value, e.g.:
READ Data SET L=$LENGTH(Data) SET CRC=$EXTRACT(Data,L-3,L) SET DATA=$EXTRACT(Data,1,L-4) IF $%CRC32^STRING(Data)'=CRC DO Error
A check-sum can also be calculated over multiple strings:
SET(I,C)=0 FOR SET I=$ORDER(X(I)) QUIT:'I DO . SET C=$%CRC32^STRING(X(I),C)
The MDC has approved code to approximate the return value of this function. Implementors are encouraged to provide more accurate and efficient code). Click here to view or download the code for this function. Click here to view or download the code for all M[UMPS] Library Functions.
This document is © Ed de Moel, 1995-2005.
It is part of a book by Ed de Moel that is published under the title "M[UMPS] by Example" (ISBN 0-918118-42-5).
Printed copies of the book are no longer available.
This document describes the various library functions that are defined for the M[UMPS] programming language.
The information in this document is NOT authoritative
and subject to be modified at any moment.
Please consult the appropriate (draft) language standard for an authoritative definition.
In this document, information is included that will
The MDC cannot guarantee that these 'next' standards will indeed appear.