00001 char *cvsinfo = "cvsinfo: $Header: /home/cvsuser/cvsroot/JSOC/proj/mag/synop/apps/synop-calversfunctions.c,v 1.1 2016/05/05 19:49:28 arta Exp $";
00002
00003 #include <stdio.h>
00004 #include <math.h>
00005 #include <stdlib.h>
00006 #include <time.h>
00007 #include <sys/time.h>
00008 #include <sys/resource.h>
00009 #include "jsoc_main.h"
00010
00011
00012
00013
00014
00015
00016 unsigned long long getbits(unsigned long long x, int p, int n)
00017 {
00018 return (x >> (p+1-n)) & ~(~0ull << n);
00019 }
00020
00021
00022
00023
00024 unsigned long long setbits(unsigned long long x, int p, int n, unsigned long long y)
00025 {
00026 return (x & ((~0ull << (p + 1)) | (~(~0ull << (p + 1 - n))))) | ((y & ~(~0ull << n)) << (p + 1 - n));
00027
00028
00029 }
00030
00031 unsigned long long fixcalver64(unsigned long long x)
00032 {
00033 int firstnibble = getbits(x,3,4);
00034 if (firstnibble == 0)
00035 return setbits(x,3,4,2);
00036 else
00037 return x;
00038 }
00039
00040