mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
add an align4() function
This commit is contained in:
parent
1682faa1b0
commit
7969f4dccb
@ -2607,13 +2607,26 @@ align a pointer to a multiple of 2 bytes
|
||||
********************************************************************/
|
||||
char *align2(char *q, char *base)
|
||||
{
|
||||
if ((q - base) & 1)
|
||||
if (PTR_DIFF(q, base) & 1)
|
||||
{
|
||||
q++;
|
||||
}
|
||||
return q;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
align a pointer to a multiple of 4 bytes.
|
||||
********************************************************************/
|
||||
char *align4(char *q, char *base)
|
||||
{
|
||||
int mod = PTR_DIFF(q, base) & 3;
|
||||
if (mod != 0)
|
||||
{
|
||||
q += 4-mod;
|
||||
}
|
||||
return q;
|
||||
}
|
||||
|
||||
void out_ascii(FILE *f, unsigned char *buf,int len)
|
||||
{
|
||||
int i;
|
||||
|
Loading…
Reference in New Issue
Block a user