• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Question about getBytes:length:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about getBytes:length:


  • Subject: Re: Question about getBytes:length:
  • From: "Eric E. Dolecki" <email@hidden>
  • Date: Tue, 24 Nov 2015 05:04:04 +0000

That method is not my code so I can't speak to it. It's from a github
example from a company supplying BT shields for Arduino.

On Mon, Nov 23, 2015 at 11:57 PM Charles Srstka <email@hidden>
wrote:

> On Nov 23, 2015, at 9:55 PM, Eric E. Dolecki <email@hidden> wrote:
>
> -(int) compareCBUUIDToInt:(CBUUID *)UUID1 UUID2:(UInt16)UUID2
> {
>    char b1[16];
>
> *   [UUID1.data getBytes:b1]; //<---*
>
>    UInt16 b2 = [self swap:UUID2];
>    if (memcmp(b1, (char *)&b2, 2) == 0)
>        return 1;
>    else
>        return 0;
> }
>
>
> Is there a possible typo here? It looks like you’re reading in 16 *bytes*
> of data, and then comparing it against an integer that is 16 *bits* in
> size. Is that what you meant to do?
>
> At any rate, you’re only comparing the first two bytes here; the other
> fourteen will never be used, unless the code above is a simplification.
>
> Charles
>
>
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Question about getBytes:length:
      • From: Charles Srstka <email@hidden>
References: 
 >Question about getBytes:length: (From: "Eric E. Dolecki" <email@hidden>)
 >Re: Question about getBytes:length: (From: Charles Srstka <email@hidden>)

  • Prev by Date: Re: Question about getBytes:length:
  • Next by Date: Re: Question about getBytes:length:
  • Previous by thread: Re: Question about getBytes:length:
  • Next by thread: Re: Question about getBytes:length:
  • Index(es):
    • Date
    • Thread