Skip to content

Instantly share code, notes, and snippets.

@m1lkweed
Last active February 6, 2023 07:13
Show Gist options
  • Save m1lkweed/ea9d943268908e69129a142a7777fa77 to your computer and use it in GitHub Desktop.
Save m1lkweed/ea9d943268908e69129a142a7777fa77 to your computer and use it in GitHub Desktop.
// The following codes and algorithms have all been patented at some point, and some still are.
#define MICROSOFT_PATENTED_OPERATOR(x, y) (&(x) != &(y))
// The address-wise ISNOT operator is patent-protected for BASIC compilers
// by Microsoft until 2024. US Patent #20040230959
// https://image-ppubs.uspto.gov/dirsearch-public/print/downloadPdf/20040230959
typedef ptrdiff_t selfptr_t;
static inline selfptr_t set_selfptr(selfptr_t *ptr, void *addr){
*ptr = (unsigned char*)addr - (unsigned char*)*ptr;
return *ptr;
}
static inline void *get_selfptr(selfptr_t ptr){
return (void*)((unsigned char*)ptr + ptr);
}
// Self-relative pointers were patented until 2020, according to google patent search.
// USPTO has nothing to confirm this, so this patent may still be enforced until September
// 23, 2023. US Patent #6,625,718
// https://image-ppubs.uspto.gov/dirsearch-public/print/downloadPdf/6625718
// More to come
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment