Code analyze need help please

Hi all.
the line below is from a GPS sketch, question is what happened resulted the condition '0' or '1'?
Is it need all of the parameters changes or just one?
Thanks
Adam

 if (!checkMap(flat, flon, level, &mKeyPath, &mKeyName, &mKeyExt, &pixelSubX, &pixelSubY))  // remove ! for test
    {......}

thanks.

the relative section:

static boolean checkMap(float lat, float lon, uint8_t lev, unsigned long* keyPath, unsigned long* keyName, uint8_t* keyExt, uint8_t* pix, uint8_t* piy)
{
  boolean isEq = false;

  unsigned long tKeyPath, tKeyName;
  uint8_t tExt;
  //  uint8_t tPix=0,tPiy=0;

  lat = lat + AjustLat;
  lon = lon + AjustLon;
  localMe(lat, lon, lev, &tKeyPath, &tKeyName, &tExt, pix, piy);

  if ((tKeyPath == *keyPath) && (tKeyName == *keyName) && (tExt == *keyExt)) // && (tPix == *pix) && (tPiy == *piy)
  {
    isEq = true;
  }
  else
  {
    *keyPath = tKeyPath;
    *keyName = tKeyName;
    *keyExt = tExt;
  }
  //  *pix=tPix;
  //  *piy=tPiy;
  return isEq;
}

This results in "1"...

... anything else results in "0"...

You should know by now that you should post the complete program when you have a question concerning it.

2 Likes

yes I knew it.
it was a multi subs sketch.

actually the question may be simple? if as below how to get "0" or "1" by:

static boolean checkMap(x1, x2, x3)
{}


unclear.

what type of variables are x1, x2, x3??

two of multiple billion ways to make the function return "1" or "0"

static boolean checkMap(byte x1, byte x2, byte x3) {
  byte result = 0;
  if (x1 == 1) {
    result = 1;
}
static boolean checkMap(byte x1, byte x2, byte x3) {
  byte result = 0;
  if (x3 == 255) {
    result = 1;
}

you will have to specify with more words what you really want

1 Like

great.
this is exactly what I like to know:
what happened resulted the condition '0' or '1'?

is that mean all x = 0, restlt = 0?

as I said you will have to use more words to specify:

what condition?

what "what"?

See Post #4

1 Like

Yes, it is.
I didn't understand then.

This thread is really funny
me neither

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.