本文整理汇总了C#中KopiLua.CharPtr.add方法的典型用法代码示例。如果您正苦于以下问题:C# CharPtr.add方法的具体用法?C# CharPtr.add怎么用?C# CharPtr.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KopiLua.CharPtr
的用法示例。
在下文中一共展示了CharPtr.add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: luaU_header
/*
* make header
*/
public static void luaU_header(CharPtr h)
{
h = new CharPtr(h);
int x=1;
memcpy(h, LUA_SIGNATURE, LUA_SIGNATURE.Length);
h = h.add(LUA_SIGNATURE.Length);
h[0] = (char)LUAC_VERSION;
h.inc();
h[0] = (char)LUAC_FORMAT;
h.inc();
//*h++=(char)*(char*)&x; /* endianness */
h[0] = (char)x; /* endianness */
h.inc();
h[0] = (char)sizeof(int);
h.inc();
h[0] = (char)sizeof(uint);
h.inc();
h[0] = (char)sizeof(Instruction);
h.inc();
h[0] = (char)sizeof(lua_Number);
h.inc();
//(h++)[0] = ((lua_Number)0.5 == 0) ? 0 : 1; /* is lua_Number integral? */
h[0] = (char)0; // always 0 on this build
}
示例2: strftime
// This strftime implementation has been made following the
// Sanos OS open-source strftime.c implementation at
// http://www.jbox.dk/sanos/source/lib/strftime.c.html
private static uint strftime(CharPtr s, uint maxsize, CharPtr format, DateTime t)
{
int sIndex = s.index;
CharPtr p = StrFTimeFmt((format as object) == null ? "%c" : format, t, s, s.add((int)maxsize));
if (p == s + maxsize) return 0;
p[0] = '\0';
return (uint)Math.Abs(s.index - sIndex);
}