MStream.C File Reference

#include <string.h>
#include "Communicate.h"
#include "MStream.h"
#include "converse.h"
#include "Debug.h"

Go to the source code of this file.

Classes

struct  StreamMessage

Defines

#define MIN_DEBUG_LEVEL   2

Functions

static int checkSum (StreamMessage *msg)


Define Documentation

#define MIN_DEBUG_LEVEL   2

Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000 by The Board of Trustees of the University of Illinois. All rights reserved.

Definition at line 12 of file MStream.C.


Function Documentation

static int checkSum ( StreamMessage msg  )  [static]

Definition at line 65 of file MStream.C.

References StreamMessage::checksum, StreamMessage::data, DebugM, StreamMessage::index, StreamMessage::len, NAMD_bug(), and StreamMessage::tag.

00066 {
00067   int checksum = 0;
00068   for ( size_t i=0; i < msg->len; i++ ) {
00069     checksum += (unsigned char) msg->data[i];
00070   }
00071   if ( checksum != msg->checksum ) {
00072     DebugM(5,"Error on " << msg->tag << ":" << msg->index <<
00073           " of length " << msg->len <<
00074           " with checksum " << ((int)checksum) <<
00075           " vs " << ((int)(msg->checksum)) <<"\n");
00076     NAMD_bug("MStream checksums do not agree!");
00077   }
00078   return 1;
00079 }


Generated on Mon Nov 20 01:17:16 2017 for NAMD by  doxygen 1.4.7